Index: branches/5.2.x/core/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r14585 -r14628 --- branches/5.2.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 14585) +++ branches/5.2.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 14628) @@ -1,6 +1,6 @@ Application->GetVar('section_name'); + $sections_helper =& $this->Application->recallObject('SectionsHelper'); + /* @var $sections_helper kSectionsHelper */ + $section_data =& $sections_helper->getSectionData($section_name); $block_params = array_merge($section_data, Array('name' => $params['render_as'], 'section_name' => $section_name)); @@ -326,8 +329,7 @@ $params[$param_name] = kUtil::replaceModuleSection($param_value); } - $m =& $this->Application->recallObject('m_TagProcessor'); - return $m->ModuleInclude($params); + return $this->Application->ProcessParsedTag('m', 'ModuleInclude', $params); } function TodayDate($params) @@ -493,71 +495,83 @@ // user can override default parameters (except pass_through of course) $params = array_merge($default_params, $params); - $main_processor =& $this->Application->recallObject('m_TagProcessor'); - return $main_processor->T($params); + return $this->Application->ProcessParsedTag('m', 'T', $params); } function TimeFrame($params) { $w = adodb_date('w'); $m = adodb_date('m'); $y = adodb_date('Y'); + //FirstDayOfWeek is 0 for Sunday and 1 for Monday $fdow = $this->Application->ConfigValue('FirstDayOfWeek'); - if ($fdow && $w == 0) $w = 7; - $today_start = adodb_mktime(0,0,0,adodb_date('m'),adodb_date('d'),$y); - $first_day_of_this_week = $today_start - ($w - $fdow)*86400; - $first_day_of_this_month = adodb_mktime(0,0,0,$m,1,$y); - $this_quater = ceil($m/3); - $this_quater_start = adodb_mktime(0,0,0,$this_quater*3-2,1,$y); - switch ($params['type']) { + if ( $fdow && $w == 0 ) { + $w = 7; + } + $today_start = adodb_mktime(0, 0, 0, adodb_date('m'), adodb_date('d'), $y); + $first_day_of_this_week = $today_start - ($w - $fdow) * 86400; + $first_day_of_this_month = adodb_mktime(0, 0, 0, $m, 1, $y); + $this_quater = ceil($m / 3); + $this_quater_start = adodb_mktime(0, 0, 0, $this_quater * 3 - 2, 1, $y); + + switch ( $params['type'] ) { case 'last_week_start': - $timestamp = $first_day_of_this_week - 86400*7; + $timestamp = $first_day_of_this_week - 86400 * 7; break; + case 'last_week_end': $timestamp = $first_day_of_this_week - 1; break; case 'last_month_start': - $timestamp = $m == 1 ? adodb_mktime(0,0,0,12,1,$y-1) : adodb_mktime(0,0,0,$m-1,1,$y); + $timestamp = $m == 1 ? adodb_mktime(0, 0, 0, 12, 1, $y - 1) : adodb_mktime(0, 0, 0, $m - 1, 1, $y); break; + case 'last_month_end': - $timestamp = $first_day_of_this_month = adodb_mktime(0,0,0,$m,1,$y) - 1; + $timestamp = $first_day_of_this_month = adodb_mktime(0, 0, 0, $m, 1, $y) - 1; break; case 'last_quater_start': - $timestamp = $this_quater == 1 ? adodb_mktime(0,0,0,10,1,$y-1) : adodb_mktime(0,0,0,($this_quater-1)*3-2,1,$y); + $timestamp = $this_quater == 1 ? adodb_mktime(0, 0, 0, 10, 1, $y - 1) : adodb_mktime(0, 0, 0, ($this_quater - 1) * 3 - 2, 1, $y); break; + case 'last_quater_end': $timestamp = $this_quater_start - 1; break; case 'last_6_months_start': - $timestamp = $m <= 6 ? adodb_mktime(0,0,0,$m+6,1,$y-1) : adodb_mktime(0,0,0,$m-6,1,$y); + $timestamp = $m <= 6 ? adodb_mktime(0, 0, 0, $m + 6, 1, $y - 1) : adodb_mktime(0, 0, 0, $m - 6, 1, $y); break; case 'last_year_start': - $timestamp = adodb_mktime(0,0,0,1,1,$y-1); + $timestamp = adodb_mktime(0, 0, 0, 1, 1, $y - 1); break; + case 'last_year_end': - $timestamp = adodb_mktime(23,59,59,12,31,$y-1); + $timestamp = adodb_mktime(23, 59, 59, 12, 31, $y - 1); break; + + default: + $timestamp = 0; + break; } - - if (isset($params['format'])) { + if ( isset($params['format']) ) { $format = $params['format']; - if(preg_match("/_regional_(.*)/", $format, $regs)) - { + + if ( preg_match("/_regional_(.*)/", $format, $regs) ) { $lang =& $this->Application->recallObject('lang.current'); + /* @var $lang LanguagesItem */ + $format = $lang->GetDBField($regs[1]); } + return adodb_date($format, $timestamp); } return $timestamp; - } /** @@ -813,14 +827,21 @@ return $skin_helper->AdminSkinTag($params); } - function PrintCompileErrors($params) + /** + * Prints errors, discovered during mass template compilation + * + * @param $params + * @return string + * @access protected + */ + protected function PrintCompileErrors($params) { $block_params = $this->prepareTagParams($params); $block_params['name'] = $params['render_as']; $errors = $this->Application->RecallVar('compile_errors'); - if (!$errors) { - return ; + if ( !$errors ) { + return ''; } $ret = '';