public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); if ($event->status == ViewController::ENTITY_STATUS_NOT_VISIBLE) { return; } $param = $event->objectParameter; $name = $param->getFieldName(); if ($name == 'id_php_script') { /** * @var $instance SiteModule */ $instance = $event->model; // Определяем тип создаваемого/редактируемого раздела $static = true; if (!$instance->isNewRecord) { if ($instance->id_php_script != null) { $static = false; } } else { if (HU::get(ObjectUrlRule::PARAM_SYSTEM_MODULE) != null) { $static = false; } } if ($static) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } } }
public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); if ($event->status == ViewController::ENTITY_STATUS_NOT_VISIBLE) { return; } $param = $event->objectParameter; $name = $param->getFieldName(); $pkey = HU::get(ObjectUrlRule::PARAM_OBJECT_PARENT); if ($pkey == null) { // Для системных модулей if (in_array($name, array('properties', 'installer'))) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; return; } if ($name == 'id_object') { // TODO временно не поддерживается //$param->sql = "parent_object IS NULL OR object_type <> ".DA_OBJECT_TYPE_HEIR; } } else { // Для функциональностей if (in_array($name, array('id_object', 'id_module_handler'))) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; return; } } // Для всех if ($name == 'php_script_type' && !Yii::app()->user->checkAccess(DaWebUser::ROLE_DEV)) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } }
public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); if ($event->status == ViewController::ENTITY_STATUS_NOT_VISIBLE) { return; } $param = $event->objectParameter; $name = $param->getFieldName(); if (in_array($name, array('unique_name'))) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } /*if ($name == "file") { $idGroup = $urlPage->GET(DA_URL_GROUP_INSTANCE); $inst = new BannerPlace(); if ($idGroup != null && $inst->load($idGroup)) { $idObject = $inst->getParam("id_object"); $idInstance = $inst->getParam("id_instance"); if ($idObject == DA_OBJECT_MODULE) { // По idGroup выводим заголовок по размерам баннеров. $idGroup - как правило фиксированы if ($idGroup == 1) { $param->caption .= " (ширина 339 px)"; } } } }*/ // Если экз. новый, то выходим $instance = $event->model; if (is_null($instance->getIdInstance()) && $name == "statBanner") { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } }
public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); if ($event->status == ViewController::ENTITY_STATUS_NOT_VISIBLE) { return; } $param = $event->objectParameter; $name = $param->getFieldName(); if (in_array($name, array('id_object', 'id_instance'))) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; return; } if ($name == 'ip') { $event->status = ViewController::ENTITY_STATUS_READ_ONLY; return; } /** * @var $comment CommentYii */ $comment = $event->model; //Показывать автора-пользователя Если id_user не null if ($name == 'comment_name' && $comment->id_user != null) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; return; } //Поле "Пользователь" не заполнено user-ом или оно вообще не показывалось if ($name == 'id_user' && $comment->id_user == null) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; return; } }
public function onParameterAvailable(ParameterAvailableEvent $event) { if ($event->objectParameter->getIdParameter() == '75') { // ид объекта $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } parent::onParameterAvailable($event); }
public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); $module = Yii::app()->getModule('news'); $param = $event->objectParameter; $name = $param->getFieldName(); if (!$module->showCategories && $name == 'id_news_category') { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } }
public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); if ($event->status == ViewController::ENTITY_STATUS_NOT_VISIBLE) { return; } $param = $event->objectParameter; $name = $param->getFieldName(); if (in_array($name, array('id_photogallery_object', 'id_photogallery_instance'))) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } }
public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); if ($event->status == ViewController::ENTITY_STATUS_NOT_VISIBLE) { return; } $param = $event->objectParameter; $name = $param->getFieldName(); if (in_array($name, array('name', 'domain_path', 'path2data_http', 'id_default_page', 'settings')) && !Yii::app()->user->checkAccess(DaWebUser::ROLE_DEV)) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } }
public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); if ($event->status == ViewController::ENTITY_STATUS_NOT_VISIBLE) { return; } $param = $event->objectParameter; $name = $param->getFieldName(); if (in_array($name, array('id_group_system_parameter', 'id_parameter_type', 'name')) && !Yii::app()->user->checkAccess(DaWebUser::ROLE_DEV)) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } if (in_array($name, array('note')) && !Yii::app()->user->checkAccess(DaWebUser::ROLE_DEV)) { $event->status = ViewController::ENTITY_STATUS_READ_ONLY; } }
public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); return; if ($event->status == ViewController::ENTITY_STATUS_NOT_VISIBLE) { return; } $param = $event->objectParameter; $name = $param->getFieldName(); /** * @var $instance Menu */ /*$instance = $event->params['model']; if ($instance->isNewRecord && $name == 'removable') { $instance->setRemovable(true); }*/ return; // Определяем тип создаваемого/редактируемого раздела /*$static = true; if ($instance->getIdInstance() != null) { if ($instance->getParam("handler") != null) { $static = false; } } else { global $urlPage; if ($urlPage->GET(DA_URL_MODULE) != null) { $static = false; } } if ($static) { if ($name == "handler") { return DA_INSTANCE_NOT_VISIBLE; } } else { // динамический раздел $disable = array("content", "listFiles", "go_to_type"); if (in_array($name, $disable)) { return DA_INSTANCE_NOT_VISIBLE; } //Если новый раздел, то по умолчанию снимаем галку "Удалять раздел" if ($instance->isNew() && $name == 'removable') { $instance->setRemovable(false); } } return DA_INSTANCE_AVAILABLE;*/ }
public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); if ($event->status == ViewController::ENTITY_STATUS_NOT_VISIBLE) { return; } $param = $event->objectParameter; $name = $param->getFieldName(); if (in_array($name, array('id_object', 'id_instance'))) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } $idObject = intval(HU::get(self::URL_PARAM_OBJECT)); $idInstance = intval(HU::get(self::URL_PARAM_INSTANCE)); $pk = intval(HU::get(ObjectUrlRule::PARAM_OBJECT_PARENT)); //Если есть группировка по объекту или у места есть родитель, скрываем свойство выбора if ($name == 'banner_place' && ($idObject && $idInstance || $pk)) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } }
public function onParameterAvailable(ParameterAvailableEvent $event) { parent::onParameterAvailable($event); if ($event->status == ViewController::ENTITY_STATUS_NOT_VISIBLE) { return; } $param = $event->objectParameter; $name = $param->getFieldName(); if (!Yii::app()->user->checkAccess(DaWebUser::ROLE_DEV)) { if (in_array($name, array('rid', 'create_date', 'count_post', 'group'))) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; return; } } if ($name == "create_date") { $instance = $event->model; if ($instance->getIdInstance() == null) { $event->status = ViewController::ENTITY_STATUS_NOT_VISIBLE; } else { $event->status = ViewController::ENTITY_STATUS_READ_ONLY; } } }