コード例 #1
0
 /**
  * Toggles the exclusion of a template
  *
  */
 function toggleTemplate()
 {
     //JResponse::setHeader('Cache-Control','no-cache, must-revalidate',true); // HTTP 1.1 - Cache control
     //JResponse::setHeader('Expires','Sat, 26 Jul 1997 05:00:00 GMT',true); // HTTP 1.0 - Date in the past
     // Get the option passed along
     $root = $this->input->get('root', '', 'string');
     $item = $this->input->get('item', '', 'string');
     // Try to figure out if this component is allowed to be excluded (exists and is non-Core)
     $model = $this->getThisModel();
     $templates = $model->getTemplates();
     $found = false;
     $numRows = count($templates);
     for ($i = 0; $i < $numRows; $i++) {
         $row = $templates[$i];
         if ($row['item'] == $item && $row['root'] == $root) {
             $found = true;
             $name = $row['name'];
             break;
         }
     }
     $link = JURI::base() . 'index.php?option=com_akeeba&view=extfilter&task=templates';
     if (!$found) {
         $msg = JText::sprintf('EXTFILTER_ERROR_INVALIDTEMPLATE', $item);
         $this->setRedirect($link, $msg, 'error');
     } else {
         $model->toggleTemplateFilter($root, $item);
         $msg = JText::sprintf('EXTFILTER_MSG_TOGGLEDTEMPLATE', $name);
         $this->setRedirect($link, $msg);
     }
     parent::redirect();
 }