public function loadModel($id) { if (($model = AttributeCategory::model()->findByPk($id)) === null) { throw new CHttpException(404, 'Страница не найдена'); } return $model; }
public function actionIndex() { $allowedTypes = array('elements', 'elements_signes', 'personalities', 'power_ci', 'signes', 'symbolic_stars', 'check_interaction'); $type = Yii::app()->getRequest()->getParam('type'); if (!in_array($type, $allowedTypes)) { throw new CHttpException(403, 'Недопустимый раздел'); } // Загрузка иероглифов $categories = array(); $categoriesList = AttributeCategory::model()->with('attrs', 'attrs.children')->findAll(); foreach ($categoriesList as $category) { $categories[$category->code] = $category; } // Тип взаимодействия $interactionType = (int) Yii::app()->getRequest()->getParam('interaction_type', null); // Атрибуты $attributes = Yii::app()->getRequest()->getParam('attributes', array()); // Анализ взаимодействия $interactionResult = isset($_GET['get_result']) ? $this->_getInteractionResult($interactionType, $attributes) : null; // Сохранение новых данных о результате $this->_saveResult(); //var_dump($interactionResult); //exit(); $this->render('index', array('type' => $type, 'interactionType' => $interactionType, 'categories' => $categories, 'attributes' => $attributes, 'interactionResult' => $interactionResult)); }
public function init() { parent::init(); // Выборка категорий/атрибутов $this->categoriesA = AttributeCategory::model()->is_a()->with('attrs')->findAll(); $this->categoriesB = AttributeCategory::model()->is_b()->with('attrs')->findAll(); // Выборка списка мест $placeCategory = AttributeCategory::model()->find('t.code = :code', array(':code' => AttributeCategory::PLACES_CATEGORY_CODE)); $this->places = Attribute::model()->category($placeCategory->id)->sortByCode()->findAll(); $this->operations = array('and' => 'и присутствует', 'and_not' => 'и отсутствует', 'or' => 'или'); $this->cells = array('sameСell' => 'Та же ячейка', 'anotherOpenCellInSameColumn' => 'Другая открытая ячейка в том же столпе', 'rightAndLeftCells' => 'Ячейки, стоящие справа и слева', 'notRightAndLeftCells' => 'Любая ячейка, кроме стоящих непосредственно слева и справа', 'anotherCell' => 'Любая другая ячейка', 'destinyPillars' => 'Столпы судьбы', 'currentLuckPillar' => 'Текущий столп удачи', 'eventPillars' => 'Столпы рассматриваемой даты'); }
public function getElementList() { $elementCategory = AttributeCategory::model()->find('t.code = :code', array(':code' => AttributeCategory::ELEMENT_CATEGORY_CODE)); $elements = Attribute::model()->category($elementCategory->id)->with('children')->sortByCode()->getTabList(); return $elements; }
public function getCategoryAttributeList() { // Выборка списка атрибутов return AttributeCategory::model()->is_a()->with('attrs')->findAll(); }