getGadgetStatus( $gadgetName ) ;
$placeHolderArr = array() ;
$isDevice = self::getDeviceDetails() ;
$isios = ($isDevice == 'ipad') ? true : false;
$isandroid = ($isDevice == 'android') ? true : false;
if ($isios && IOFFLINE_IOS_APP=='ON') {
$isoCheck = true;
} elseif ($isandroid && IOFFLINE_ANDROID_APP=='ON') {
$androidCheck = true;
} else {
$isdesktop = true;
}
$placeHolderArr['if']['spark_carousel'] = '( SPARK_CAROUSEL == "ON" )';
$placeHolderArr['if']['isios'] = '( $isoCheck )';
$placeHolderArr['if']['isandroid'] = '( $androidCheck )';
$placeHolderArr['if']['isdesktop'] = '( $isdesktop )';
$placeHolderArr['if']['DOWNLOAD_INSTRUCTION'] ='(DOWNLOAD_INSTRUCTION=="TRUE")';
$placeHolderArr['echo_token']['CP_IPAD_APP_STORE_URL'] ='CP_IPAD_APP_STORE_URL';
$placeHolderArr['echo_token']['CP_ANDROID_AAP_STORE_URL'] ='CP_ANDROID_AAP_STORE_URL';
$placeHolderArr['echo_token']['APP_DOWNLOAD_INSTRUCTION'] ='"/staticcms/appinformation"';
$placeHolderArr['php_token']['NativeappAlreadyRegistered'] = '$NativeappAlreadyRegistered = (defined(\'SPARK_NATIVE_APP_INFO\')&&(SPARK_NATIVE_APP_INFO!=\'\'))?constant(\'SPARK_NATIVE_APP_INFO\'):$translator->_( "NativeappAlreadyRegistered" );';
$placeHolderArr['echo_token']['NativeappAlreadyRegistered'] = '$NativeappAlreadyRegistered' ;
$placeHolderArr['php_token']['ScholarNativeappIos'] = '$ScholarNativeappIos = (defined(\'SPARK_NATIVE_APP_IOS\')&&(SPARK_NATIVE_APP_IOS!=\'\'))?constant(\'SPARK_NATIVE_APP_IOS\'):$translator->_( "ScholarNativeappIos" );';
$placeHolderArr['echo_token']['ScholarNativeappIos'] = '$ScholarNativeappIos' ;
$placeHolderArr['php_token']['ScholarNativeappAndroid'] = '$ScholarNativeappAndroid = (defined(\'SPARK_NATIVE_APP_ANDROID\')&&(SPARK_NATIVE_APP_ANDROID!=\'\'))?constant(\'SPARK_NATIVE_APP_ANDROID\'):$translator->_( "ScholarNativeappAndroid" );';
$placeHolderArr['echo_token']['ScholarNativeappAndroid'] = '$ScholarNativeappAndroid' ;
$placeHolderArr['php_token']['ScholarNativeappDesktop'] = '$ScholarNativeappDesktop = (defined(\'SPARK_NATIVE_APP_DESKTOP\')&&(SPARK_NATIVE_APP_DESKTOP!=\'\'))?constant(\'SPARK_NATIVE_APP_DESKTOP\'):$translator->_( "ScholarNativeappDesktop" );';
$placeHolderArr['echo_token']['ScholarNativeappDesktop'] = '$ScholarNativeappDesktop' ;
$placeHolderArr['echo_token']['ScholarNativeappDesktopios'] = '$translator->_( "ScholarNativeappDesktopios" )' ;
$placeHolderArr['echo_token']['ScholarNativeappDesktopAndroid'] = '$translator->_( "ScholarNativeappDesktopAndroid" )' ;
$placeHolderArr['echo_token']['ScholarNativeappDesktopDesktop'] = '$translator->_( "ScholarNativeappDesktopDesktop" )' ;
$placeHolderArr['echo_token']['Addbuttoninsti'] = ' $translator->_("Addbuttoninsti" ) ';
$placeHolderArr['echo_token']['Addbuttoninstitooltip'] = ' $translator->_("Addbuttoninstitooltip" ) ';
$placeHolderArr['echo_token']['Addbuttoninstitooltip1'] = ' $translator->_("Addbuttoninstitooltip1" ) ';
$placeHolderArr['echo_token']['Addbuttoninstitooltip2'] = ' $translator->_("Addbuttoninstitooltip2" ) ';
$placeHolderArr['echo_token']['Addbuttoninstitooltip3'] = ' $translator->_("Addbuttoninstitooltip3" ) ';
$placeHolderArr['echo_token']['Addbuttoninstitooltip4'] = ' $translator->_("Addbuttoninstitooltip4" ) ';
$placeHolderArr['echo_token']['Addbuttonindi'] = ' $translator->_("Addbuttonindi" ) ';
$placeHolderArr['echo_token']['Addbuttonindivtooltip'] = ' $translator->_("Addbuttonindivtooltip" ) ';
$placeHolderArr['echo_token']['Addbuttonindivtooltip1'] = ' $translator->_("Addbuttonindivtooltip1" ) ';
$placeHolderArr['echo_token']['Addbuttonindivtooltip2'] = ' $translator->_("Addbuttonindivtooltip2" ) ';
$placeHolderArr['echo_token']['Addbuttonindivtooltip3'] = ' $translator->_("Addbuttonindivtooltip3" ) ';
$placeHolderArr['echo_token']['Addbuttonindivtooltip4'] = ' $translator->_("Addbuttonindivtooltip4" ) ';
// Setting the compiled template path for this(pincode) gadget
$compiledTplPath = 'compiledtpl/' . $gadgetName . '_' . $zoneCode . '.tpl.php' ;
// Setting the template path for this(pincode) gadget
$templatePath = $gadgetName . '/' . $gadgetName . '_' . $zoneCode . '.tpl' ;
// Setting the generic path for this(pincode) gadget
$genericPath = ABSOLUTE_PATH . DEFAULT_THEME_PATH . 'gadgets/' ;
// Setting the customized path for this(pincode) gadget
$customizedPath = ABSOLUTE_PATH . SITE_THEME_PATH . 'gadgets/' ;
// Checks whether bookshelf gadget generic or not,
// if it is then setting template file and compiled template file paths are generic one
// else setting template file and compiled template file paths are customized one
if ( $templateStatus == 'GENERIC' ) {
$templateFile = $genericPath . $templatePath ;
$compiledTplFile = $genericPath . $compiledTplPath ;
} else {
// Checks whether customized file exists or not , if it is then it 'll take customized else generic one
if ( file_exists( $customizedPath . $templatePath ) ) {
$templateFile = $customizedPath . $templatePath ;
$compiledTplFile = $customizedPath . $compiledTplPath ;
} else {
$templateFile = $genericPath . $templatePath ;
$compiledTplFile = $genericPath . $compiledTplPath ;
}
}
// Checks whether the compiled template file exists or not,
// if it is not then using the ipc_gadget_render::render() function to create it,
// if it is then checking the modify time with the original template file
// and if the original file modified then recreate the compiled template file
if ( !file_exists( $compiledTplFile ) ) {
ipc_gadget_render::render( $compiledTplFile , $templateFile , $placeHolderArr ) ;
} else if ( filemtime( $templateFile ) > filemtime( $compiledTplFile ) ||
filemtime( __FILE__ ) > filemtime( $compiledTplFile ) ) {
ipc_gadget_render::render( $compiledTplFile , $templateFile , $placeHolderArr ) ;
}
ob_start();
// including the compiled template file
require_once( $compiledTplFile ) ;
$gadGetHtml=ob_get_contents();
ob_end_clean();
echo $gadGetHtml;
if($cacheable){
$tags = array( $cacheId, 'gadget' ) ;
iplat_cache::saveCache( $cacheDir , $gadGetHtml, $cacheId , $tags ) ;
}
}else{
echo iplat_cache::loadCache( $cacheDir , $cacheId );
}
}
} catch( Exception $e ) {
echo $msg = 'Exception => " ' . __FILE__ . ' -- ipc_html_fluid_pincode::render() " ' . "\n" . $e->getMessage() ;
ipc_log::logMessages( 'pincode_logs' , $msg ) ;
}
} // End of render
/**
* Create the list action for journals.
*
* @access public
* @author Sudhir
* @param void
* @return void
*
* @since 2017
*/
public function getDeviceDetails() {
try {
$strUserAgent = strtolower( $_SERVER['HTTP_USER_AGENT'] ) ;
if ( strpos( $strUserAgent , 'ipad' ) || strpos( $strUserAgent , 'iphone' ) || strpos( $strUserAgent , 'ipod' ) ) {
$strDevice = 'ipad' ;
}
elseif ( strpos( $strUserAgent , 'android' ) ) {
$strDevice = 'android' ;
}
return $strDevice;
}
catch ( Exception $e ) {
$msg = 'Exception => " ' . __FILE__ . ' -- iplat_generic_functions::getDeviceDetails() " ' . "\n"
. $e->getMessage() ;
ipc_log::logMessages( 'iplat_generic_functions.log' , $msg ) ;
}
return false ;
} // End of getDeviceDetails
}