当前位置: 首页>>代码示例>>PHP>>正文


PHP Modules::model方法代码示例

本文整理汇总了PHP中Modules::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Modules::model方法的具体用法?PHP Modules::model怎么用?PHP Modules::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Modules的用法示例。


在下文中一共展示了Modules::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getModuleItems

 public function getModuleItems()
 {
     $basicModules = array('x2Activity', 'contacts', 'charts', 'accounts', 'opportunities', 'x2Leads', 'quotes', 'products', 'services', 'bugReports', 'users');
     $qpg = new QueryParamGenerator();
     $criteria = new CDbCriteria();
     $criteria->condition = '(name in ' . $qpg->bindArray($basicModules, true) . ' or custom) and visible and 
          moduleType in ("module", "pseudoModule") and name != "document"';
     $criteria->params = $qpg->getParams();
     $criteria->order = 'menuPosition ASC';
     $modules = Modules::model()->findAll($criteria);
     $modules = array_filter($modules, function ($module) {
         if ($module->title === 'charts') {
             $action = 'ReportsChartDashboard';
         } else {
             $action = ucfirst($module->title) . 'Index';
         }
         $authItem = Yii::app()->authManager->getAuthItem($action);
         return Yii::app()->params->isAdmin || is_null($authItem) || Yii::app()->user->checkAccess($action);
     });
     return array_map(function ($module) {
         $item = new ModulePanelItem();
         $item->module = $module;
         return $item;
     }, $modules);
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:25,代码来源:Panel.php

示例2: actionChangeStatus

 /**
  * Change Case status using select-box
  */
 public function actionChangeStatus()
 {
     // check if user has permissions to changeStatusCases
     if (Yii::app()->user->checkAccess('changeStatusCases')) {
         // verify is request was made via post ajax
         if (Yii::app()->request->isAjaxRequest && isset($_POST)) {
             // get Cases object model
             $model = $this->loadModel($_REQUEST['id']);
             // set new status
             $model->status_id = $_POST['changeto'];
             // validate and save
             if ($model->save()) {
                 // save log
                 $attributes = array('log_date' => date("Y-m-d G:i:s"), 'log_activity' => 'CaseStatusChanged', 'log_resourceid' => $model->case_id, 'log_type' => Logs::LOG_UPDATED, 'user_id' => Yii::app()->user->id, 'module_id' => Yii::app()->controller->id, 'project_id' => $model->project_id);
                 Logs::model()->saveLog($attributes);
                 // create comment to let then know that some user change the case status
                 $modelComment = new Comments();
                 $modelComment->comment_date = date("Y-m-d G:i:s");
                 $modelComment->comment_text = Status::STATUS_COMMENT . ": " . $model->Status->status_id;
                 $modelComment->user_id = Yii::app()->user->id;
                 $modelComment->module_id = Modules::model()->find(array('condition' => 't.module_name = :module_name', 'params' => array(':module_name' => $this->getId())))->module_id;
                 $modelComment->comment_resourceid = $model->case_id;
                 $modelComment->save(false);
                 // prepare email template for each project manager
                 Yii::import('application.extensions.phpMailer.yiiPhpMailer');
                 $mailer = new yiiPhpMailer();
                 $subject = Yii::t('email', 'CaseStatusChange') . " - " . $model->case_name;
                 //$Users = Users::model()->with('Clients')->findManagersByProject($model->project_id);
                 $Users = Projects::model()->findAllUsersByProject($model->project_id);
                 $recipientsList = array();
                 foreach ($Users as $client) {
                     $recipientsList[] = array('name' => $client->CompleteName, 'email' => $client->user_email);
                 }
                 // load template
                 $str = $this->renderPartial('//templates/cases/StatusChanged', array('case' => $model, 'user' => Users::model()->findByPk(Yii::app()->user->id), 'urlToCase' => "http://" . $_SERVER['SERVER_NAME'] . Yii::app()->createUrl('cases/view', array('id' => $model->case_id)), 'typeNews' => $model->status_id == Status::STATUS_ACCEPTED || $model->status_id == Status::STATUS_TOREVIEW ? 'buenas' : 'malas', 'applicationName' => Yii::app()->name, 'applicationUrl' => "http://" . $_SERVER['SERVER_NAME'] . Yii::app()->request->baseUrl), true);
                 $mailer->pushMail($subject, $str, $recipientsList, Emails::PRIORITY_NORMAL);
                 $output = Yii::t('cases', 'StatusChanged');
             } else {
                 $output = Yii::t('cases', 'StatusError');
             }
             echo $output;
             Yii::app()->end();
         } else {
             throw new CHttpException(403, Yii::t('site', '403_Error'));
         }
     } else {
         throw new CHttpException(403, Yii::t('site', '403_Error'));
     }
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:52,代码来源:CasesController.php

示例3: getConfigValues

 /**
  * Returns theme configuration
  * @param null $strClass
  * @return array|mixed
  */
 public function getConfigValues($strClass = null)
 {
     $strClass = Yii::app()->theme->name;
     $arr = array();
     $objModule = Modules::model()->findByAttributes(array('module' => $strClass, 'category' => 'theme'));
     if ($objModule instanceof Modules) {
         try {
             $arr = unserialize($objModule->configuration);
         } catch (Exception $e) {
             Yii::log("Could not unserialize " . $strClass . " . Error : " . $e, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
             return array();
         }
     }
     return $arr;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:20,代码来源:WsTheme.php

示例4: activation

 public function activation($page_id = null)
 {
     if (!is_null($page_id)) {
         $module_id = Modules::model()->getModuleIdByCode($this->id);
         ModulesInPages::model()->addLink($module_id, $page_id);
     }
 }
开发者ID:arduanov,项目名称:eco,代码行数:7,代码来源:HelperModule.php

示例5: constructMenuArray

 public static function constructMenuArray()
 {
     $arrModules = Modules::model()->findAllByAttributes(array('category' => 'CEventCustomer'), array('order' => 'name'));
     //Get active and inactive
     $arrModulesMenu = array();
     foreach ($arrModules as $module) {
         try {
             Yii::import('application.extensions.' . $module->module . '.' . $module->module);
             $objC = new $module->module();
             $arrModulesMenu[] = array('label' => $objC->name, 'url' => array('integration/integration', 'id' => $module->module));
         } catch (Exception $e) {
             Yii::log("Missing widget " . $e, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         }
     }
     $arrSocialAccountsMenu = array(array('label' => 'Social Accounts', 'linkOptions' => array('class' => 'nav-header')), array('label' => 'Edit Public Accounts', 'url' => array('integration/edit', 'id' => self::SOCIAL)));
     $arrAmazonMenu = array();
     if (Yii::app()->params['SHOW_AMAZON_INTEGRATION'] === '1') {
         $arrAmazonMenu = array(array('label' => 'Amazon', 'linkOptions' => array('class' => 'nav-header')), array('label' => 'Amazon MWS Settings', 'url' => array('integration/integration', 'id' => 'wsamazon')), array('label' => 'Match Amazon Categories to WS', 'url' => array('integration/amazonmatch')), array('label' => 'Queue for Amazon Tasks', 'url' => array('integration/amazonqueue')));
     }
     $arrEmailMenu = array(array('label' => 'Email Managers', 'linkOptions' => array('class' => 'nav-header')));
     $arrFacebookMenu = array(array('label' => 'Facebook', 'linkOptions' => array('class' => 'nav-header')), array('label' => 'Facebook Connect', 'url' => array('integration/edit', 'id' => self::FACEBOOK)));
     $arrGoogleMenu = array(array('label' => 'Google', 'linkOptions' => array('class' => 'nav-header')), array('label' => 'Google Settings', 'url' => array('integration/edit', 'id' => self::GOOGLE)), array('label' => 'Match Google Categories to WS', 'url' => array('integration/googlematch')));
     $arrMenuItems = array_merge($arrSocialAccountsMenu, $arrAmazonMenu, $arrEmailMenu, $arrModulesMenu, $arrFacebookMenu, $arrGoogleMenu);
     return $arrMenuItems;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:25,代码来源:IntegrationController.php

示例6: actionIndex

 public function actionIndex()
 {
     $step = Yii::app()->request->getParam("step", 1);
     switch ($step) {
         case 1:
             $this->render('index');
             break;
         case 2:
             $this->render('check', array('check' => environmentChecksUpdate::run()));
             break;
         case 3:
             $authGet = Yii::app()->request->getParam("auth", 'sorry');
             if (Yii::app()->request->csrfToken != $authGet) {
                 $this->render('check');
             }
             databaseConfiguration::SplitSQL(Yii::app()->getModulePath() . '/update/data/0_4/mysql_update.sql');
             $updated = array();
             $comments = Comments::model()->findAll();
             foreach ($comments as $comment) {
                 if (!in_array($comment->comment_resourceid . "," . $comment->module_id, $updated)) {
                     $module = Modules::model()->findByPk($comment->module_id)->module_className;
                     $modelClass = new $module();
                     $project = $modelClass::model()->findByPk($comment->comment_resourceid)->project_id;
                     Comments::model()->updateAll(array('project_id' => $project), 'comment_resourceid = :resourceid AND module_id = :moduleid', array(':resourceid' => $comment->comment_resourceid, ':moduleid' => $comment->module_id));
                     array_push($updated, $comment->comment_resourceid . "," . $comment->module_id);
                 }
             }
             $this->render('finish');
             break;
         default:
             $this->render('index');
             break;
     }
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:34,代码来源:DefaultController.php

示例7: actionSettings

 public function actionSettings($id)
 {
     $this->layout = '//layouts/admin';
     $model = Modules::model()->findByPk($id);
     $dbTableData = array();
     if (is_object($model)) {
         $this->pageTitle = 'Управление модулями :: ' . $model->title;
         $this->breadcrumbs = array('Управление модулями' => array('/admin/default/modules/index'), $model->title);
         $tables = Yii::app()->db->schema->getTables();
         if ($model->models) {
             $mArr = explode(",", $model->models);
             if (is_array($mArr) && count($mArr)) {
                 foreach ($mArr as $mName) {
                     $m = new $mName();
                     if (is_object($m) && isset($tables[$m->tableName()])) {
                         $dbTableData[] = $tables[$m->tableName()];
                     }
                 }
             }
         }
         /*
                         if(is_array($tables) && isset($tables[$model->tableName()])){
                             $dbTableData = $tables[$model->tableName()];
                         }*/
     }
     if (!isset($model) || !is_object($model)) {
         $this->redirect($_SERVER['HTTP_REFERER']);
     }
     $this->render("settings", array('model' => $model, 'dbTableData' => $dbTableData));
 }
开发者ID:42point,项目名称:Vinum,代码行数:30,代码来源:ModulesController.php

示例8: search

 public function search($searchAttributes, $term)
 {
     $selected = Yii::app()->user->getState('project_selected');
     if (empty($selected)) {
         Yii::app()->user->setFlash('GlobalSearchForm', Yii::t('site', 'selectOneProject'));
     }
     $items = array();
     foreach ($searchAttributes as $key => $value) {
         array_push($items, $key);
     }
     $modules = Modules::model()->findAll(array('condition' => 't.module_name IN ("' . implode('","', $items) . '")'));
     // array donde se guardaran los resultados
     $dataproviders = array();
     foreach ($modules as $module) {
         $criteria = new CDbCriteria();
         if (in_array($module->module_name, array_keys($this->searchModels))) {
             foreach ($this->searchModels[$module->module_name] as $attr) {
                 $criteria->compare($attr, $term, true, 'OR');
                 $criteria->compare('project_id', !empty($selected) ? $selected : -1);
             }
             $dataproviders[$module->module_name] = new CActiveDataProvider($module->module_className, array('criteria' => $criteria));
         }
     }
     return $dataproviders;
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:25,代码来源:GlobalSearchForm.php

示例9: displayAccessWarning

 public function displayAccessWarning()
 {
     if (Yii::app()->isCommonSSL) {
         return;
     }
     $access_warning_cookie = Yii::app()->request->cookies['access_warning'];
     if ($access_warning_cookie === null || $access_warning_cookie->value !== 'false') {
         $objModule = Modules::model()->LoadByName('wsaccesswarning');
         if (!$objModule) {
             Yii::import('ext.wsaccesswarning.models.*');
             $arrDefaultConfig = $this->getAdminModel()->getDefaultConfiguration();
             $objModule = new Modules();
             $objModule->module = 'wsaccesswarning';
             $objModule->category = 'extension';
             $objModule->name = 'Site Access Warning';
             $objModule->version = 1;
             $objModule->active = 0;
             $objModule->configuration = serialize($arrDefaultConfig);
             $objModule->save();
         }
         if ($objModule->active) {
             $arrConfig = $objModule->GetConfigValues();
             $globalScript = sprintf("var accessWarningMessage = %s;", json_encode($this->_transformMessageForDisplay($arrConfig['message'])));
             // No HTML tags are allowed in the button caption so we encode to HTML entities.
             $globalScript .= sprintf("var accessWarningButtonCaption = %s;", json_encode(CHtml::encode($arrConfig['button_caption'])));
             $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets');
             $cs = Yii::app()->getClientScript();
             $cs->registerScript('_', $globalScript, CClientScript::POS_HEAD);
             $cs->registerCssFile($assets . '/css/wsaccesswarning.css');
             $cs->registerScriptFile($assets . '/thirdparty/carhartl-jquery-cookie/jquery.cookie.js');
             $cs->registerScriptFile($assets . '/js/wsaccesswarning.js');
         }
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:34,代码来源:wsaccesswarning.php

示例10: menuCheck

 public function menuCheck($attr, $params = array())
 {
     $this->{$attr};
     $this->scenario = 'menu';
     if (sizeof(Modules::model()->findAllByAttributes(array('name' => $this->name))) > 0) {
         $this->addError('name', 'That name is not available.');
     }
 }
开发者ID:keyeMyria,项目名称:CRM,代码行数:8,代码来源:Docs.php

示例11: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $controller->module_id = Modules::model()->getModuleIdByCode($this->id);
         // this method is called before any module controller action is performed
         // you may place customized code here
         return true;
     } else {
         return false;
     }
 }
开发者ID:arduanov,项目名称:eco,代码行数:11,代码来源:GmapsModule.php

示例12: actionCreate

 /**
  * Creates a new model.
  * @return create view
  */
 public function actionCreate()
 {
     // create Logs object model
     $model = new Logs();
     // if Logs form exist
     if (isset($_POST['Logs'])) {
         // set form elements to Logs model attributes
         $model->attributes = $_POST['Logs'];
         // find module_name before save
         $module = Modules::model()->find(array('condition' => 't.module_name = :module_name', 'params' => array(':module_name' => $model->module_id)));
         // set finded module_id to module->module_id
         $model->module_id = $module->module_id;
         // save without validate
         $model->save(false);
     }
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:20,代码来源:LogsController.php

示例13: init

 /**
  * Initializes the controller.
  */
 public function init()
 {
     parent::init();
     if (!isset(Yii::app()->request->cookies['sel_lang'])) {
         Yii::app()->request->cookies['sel_lang'] = new CHttpCookie('sel_lang', 'en_us');
         Yii::app()->lc->setLanguage(Yii::app()->request->cookies['sel_lang']->value);
     } else {
         if (isset($_REQUEST['lc']) && !empty($_REQUEST['lc'])) {
             Yii::app()->request->cookies['sel_lang'] = new CHttpCookie('sel_lang', $_REQUEST['lc']);
         }
         if (in_array(strtolower(Yii::app()->request->cookies['sel_lang']->value), Yii::app()->params['languages'])) {
             Yii::app()->lc->setLanguage(Yii::app()->request->cookies['sel_lang']->value);
         }
     }
     if (isset($_GET['infoproject']) && !empty($_GET['infoproject']) && Users::model()->verifyUserInProject((int) Yii::app()->request->getParam("infoproject", 0), Yii::app()->user->id)) {
         Yii::app()->user->setState('project_selected', Yii::app()->request->getParam("infoproject", 0));
         Yii::app()->user->setState('project_selectedName', Projects::model()->findByPk(Yii::app()->user->getState('project_selected'))->project_name);
         $this->redirect(Yii::app()->createUrl('site'));
     }
     $avoid = array('companies');
     if (Yii::app()->user->getState('project_selected') == null && Yii::app()->controller->id != null && !empty(Yii::app()->controller->ActionParams['id']) && !in_array(Yii::app()->controller->id, $avoid)) {
         // Finding module class name
         $criteria = new CDbCriteria();
         $criteria->compare('module_name', Yii::app()->controller->id);
         $module = Modules::model()->find($criteria);
         if (isset($module->module_className) && class_exists($module->module_className)) {
             // create class instance
             $className = $module->module_className;
             $instance = new $className();
             // finding model record
             $criteria = new CDbCriteria();
             $criteria->compare($instance->getMetaData()->tableSchema->primaryKey, Yii::app()->controller->ActionParams['id']);
             $model = $instance->find($criteria);
             if ($model !== null) {
                 // finding model relations
                 $relations = $model->getMetaData()->relations;
                 if (array_key_exists("Projects", $relations) || $module->module_className == "Projects") {
                     if (Users::model()->verifyUserInProject($model->project_id, Yii::app()->user->id)) {
                         Yii::app()->user->setState('project_selected', $model->project_id);
                         Yii::app()->user->setState('project_selectedName', Projects::model()->findByPk($model->project_id)->project_name);
                     }
                 }
             }
         }
     }
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:49,代码来源:Controller.php

示例14: supportedModules

 public static function supportedModules(CDbCriteria $criteria = null)
 {
     $basicModules = array('x2Activity', 'topics', 'contacts', 'charts', 'accounts', 'opportunities', 'x2Leads', 'quotes', 'products', 'services', 'bugReports', 'users');
     $qpg = new QueryParamGenerator();
     $newCriteria = new CDbCriteria();
     $newCriteria->condition = '(name in ' . $qpg->bindArray($basicModules, true) . ' or custom) and visible and 
          moduleType in ("module", "pseudoModule") and name != "document"';
     $newCriteria->params = $qpg->getParams();
     $newCriteria->order = 'menuPosition ASC';
     if ($criteria) {
         $newCriteria->mergeWith($criteria);
         $criteria = $newCriteria;
     } else {
         $criteria = $newCriteria;
     }
     $modules = Modules::model()->findAll($criteria);
     return $modules;
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:18,代码来源:MobileModule.php

示例15: actionIndex

 /**
  * See if we have any events to fire
  */
 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->compare('active', 1);
     $criteria->compare('category', 'CEvent', true, 'AND');
     $objModules = Modules::model()->findAll($criteria);
     foreach ($objModules as $objModule) {
         //Find and our tasks (one of each type this cron cycle)
         $criteria = new CDbCriteria();
         $criteria->select = 'action';
         $criteria->distinct = true;
         $criteria->compare('controller', $objModule->module);
         $objTaskTypes = TaskQueue::model()->findAll($criteria);
         Yii::import('ext.' . $objModule->module . "." . $objModule->module);
         $component = new $objModule->module();
         $component->init();
         //Run init on module first
         foreach ($objTaskTypes as $objType) {
             //Locate a task of this type
             $objTask = TaskQueue::model()->findByAttributes(array('module' => 'integration', 'controller' => $objModule->module, 'action' => $objType->action));
             Yii::log("Found TaskQueue item " . $objTask->controller . " " . $objTask->action, 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
             $actionName = "OnAction" . ucfirst($objTask->action);
             $objEvent = new CEventTaskQueue(get_class($this), $objTask->data_id, $objTask->product_id);
             Yii::log("Cron action " . $actionName . " on object " . print_r($objEvent, true), 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
             //Run the action and get a true/false if it was successful
             $retVal = $component->{$actionName}($objEvent);
             if ($retVal) {
                 Yii::log("Successfully processed by Amazon, so deleting task", 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
                 $objTask->delete();
                 //Successfully ran, so delete entry
             } else {
                 Yii::log("Still waiting on Amazon, will check again next time", 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
                 $objTask->modified = new CDbExpression('NOW()');
                 $objTask->save();
             }
         }
     }
     //Create a Download Orders event to force any other subsystems to check for new orders
     if (date("i") % 10 == 0) {
         $objEvent = new CEventOrder('CronController', 'onDownloadOrders');
         _xls_raise_events('CEventOrder', $objEvent);
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:46,代码来源:CronController.php


注:本文中的Modules::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。