/** * Compile all template files * * @param string $dir_name name of directories * @return integer number of template files deleted */ function Smarty_Method_Compile_Directory($smarty, $extention = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null) { function _get_time() { $_mtime = microtime(); $_mtime = explode(" ", $_mtime); return (double) $_mtime[1] + (double) $_mtime[0]; } // set default directory if ($dir_name === null) { $dir_name = $smarty->template_dir; } // switch off time limit if (function_exists('set_time_limit')) { @set_time_limit($time_limit); } $smarty->force_compile = $force_compile; $_count = 0; $_error_count = 0; // loop over array of template directories foreach ((array) $smarty->template_dir as $_dir) { $_compileDirs = new RecursiveDirectoryIterator($_dir); $_compile = new RecursiveIteratorIterator($_compileDirs); foreach ($_compile as $_fileinfo) { if (strpos($_fileinfo, '.svn') !== false) { continue; } $_file = $_fileinfo->getFilename(); if (!substr_compare($_file, $extention, -strlen($extention)) == 0) { continue; } if ($_fileinfo->getPath() == substr($_dir, 0, -1)) { $_template_file = $_file; } else { $_template_file = substr($_fileinfo->getPath(), strlen($_dir)) . '\\' . $_file; } echo '<br>', $_dir, '---', $_template_file; flush(); $_start_time = _get_time(); try { $_tpl = $smarty->createTemplate($_template_file); $_tpl->getCompiledTemplate(); } catch (Exception $e) { echo 'Error: ', $e->getMessage(), "<br><br>"; $_error_count++; } echo ' done in ', _get_time() - $_start_time, ' seconds'; if ($max_errors !== null && $_error_count == $max_errors) { echo '<br><br>too many errors'; exit; } } } return $_count; }
function get_lastmodified($timezone = 'server', $post_type = 'any', $m = false) { return apply_filters('get_lastmodified', _get_time($timezone, 'modified', $post_type, 'last', $m), $timezone); }
function _get_data_ws(&$PDOdb, $id_ws, $tDeb, $tFin, $nb_ressource) { global $conf; $Tab = array('series' => array(), 'axis' => array()); if ($nb_ressource < 1) { $nb_ressource = 1; } $nb_hour_per_day = !empty($conf->global->TIMESHEET_WORKING_HOUR_PER_DAY) ? $conf->global->TIMESHEET_WORKING_HOUR_PER_DAY : 7; $nb_second_in_hour = 3600 * (24 / $nb_hour_per_day); $TAxis = $TSerie = array(); _init_data($TAxis, $TSerie, $tDeb, $tFin); $sql = "SELECT t.date_estimated_start,t.date_estimated_end \n FROM " . MAIN_DB_PREFIX . "projet_task t \n LEFT JOIN " . MAIN_DB_PREFIX . "projet_task_extrafields tex ON (t.rowid=tex.fk_object)\n \n WHERE tex.fk_workstation=" . $id_ws . " AND t.date_estimated_end > NOW() AND progress<100\n AND t.date_estimated_start<'" . date('Y-m-d 23:59:59', $tFin) . "' \n AND t.date_estimated_end>'" . date('Y-m-d 00:00:00', $tDeb) . "'\n ORDER BY t.date_estimated_start "; $TRes = $PDOdb->ExecuteAsArray($sql); _get_time($TRes, $TAxis, $TSerie, $tDeb, $tFin); $sql = "SELECT t.dateo as 'date_estimated_start',t.datee as 'date_estimated_end'\n FROM " . MAIN_DB_PREFIX . "projet_task t \n LEFT JOIN " . MAIN_DB_PREFIX . "projet_task_extrafields tex ON (t.rowid=tex.fk_object)\n \n WHERE tex.fk_workstation=" . $id_ws . " AND t.datee < NOW()\n AND t.dateo<'" . date('Y-m-d 23:59:59', $tFin) . "' \n AND t.datee>'" . date('Y-m-d 00:00:00', $tDeb) . "'\n ORDER BY t.dateo "; $TRes = $PDOdb->ExecuteAsArray($sql); _get_time($TRes, $TAxis, $TSerie, $tDeb, $tFin); ksort($TAxis); ksort($TSerie); foreach ($TAxis as &$val) { $val = round($val / $nb_second_in_hour / $nb_ressource / $nb_hour_per_day * 100); } $Tab['series'] = array(0 => array('data' => array_values($TAxis), 'name' => 'Usage')); $Tab['axis'] = array_values($TSerie); return $Tab; }