Exemple #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 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;
 }