Beispiel #1
0
 protected function createCondition($conditionId, MenuModel $menu, ConditionFactory $conditionFactory)
 {
     $conditionModel = ConditionModel::findByPk($conditionId);
     if ($conditionModel) {
         return $conditionFactory->create($conditionModel);
     }
     return null;
 }
 public function getCondition()
 {
     $conditionModel = ConditionModel::findByPk($this->conditionId);
     if ($conditionModel) {
         $conditionFactory = new ConditionFactory();
         $condition = $conditionFactory->create($conditionModel);
         return $condition;
     }
     return null;
 }
 public function getConditionOptions()
 {
     $options = array();
     $conditionFactory = new ConditionFactory();
     $conditionCollection = ConditionModel::findBy('pid', '0', array('order' => 'sorting'));
     if ($conditionCollection) {
         while ($conditionCollection->next()) {
             if ($conditionCollection->title) {
                 $title = $conditionCollection->title;
             } else {
                 $condition = $conditionFactory->create($conditionCollection->current());
                 $title = $condition->describe();
             }
             $options[$conditionCollection->id] = $title;
         }
     }
     return $options;
 }
Beispiel #4
0
 public function getLabel($row, $label)
 {
     try {
         $session = \Session::getInstance()->getData();
         $tree = $session['tl_xnavigation_condition_tree'];
         $type = $GLOBALS['TL_LANG']['xnavigation_condition'][$row['type']][0];
         $title = $row['title'];
         $factory = new ConditionFactory();
         $conditionModel = ConditionModel::findByPk($row['id']);
         $condition = $factory->create($conditionModel);
         if (isset($tree[$row['id']]) && $tree[$row['id']]) {
             $html = sprintf('<span style="color:#b3b3b3;padding-left:3px">%s</span>', $type);
         } else {
             $describe = $condition->describe();
             $html = sprintf('<span style="color:#b3b3b3;padding-left:3px">%s</span> <span class="condition_describe">%s</span>', $type, $describe);
         }
         if ($title) {
             $html = sprintf('%s<div style="text-indent:-23px">%s</div>', $title, $html);
         }
     } catch (\Exception $e) {
         $html = $e->getMessage();
     }
     return $html;
 }