本文整理汇总了PHP中Module::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::model方法的具体用法?PHP Module::model怎么用?PHP Module::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execApiMethod
public static function execApiMethod($method, $moduleArr)
{
$data = array();
$paramNum = func_num_args();
if (2 < $paramNum) {
$params = func_get_args();
$args = array_slice($params, 2, count($params));
} else {
$args = array();
}
$enableModule = Module::model()->fetchAllEnabledModule();
foreach ($moduleArr as $module) {
if (array_key_exists($module, $enableModule)) {
$class = ucfirst($module) . "Api";
if (class_exists($class)) {
$api = new $class();
if ($args) {
$data[$module] = call_user_func_array(array($api, $method), $args);
} else {
$data[$module] = $api->{$method}();
}
}
}
}
return $data;
}
示例2: checkModule
public function checkModule($attribute)
{
if (Module::model()->exists('name=:name AND only_one=1', array(':name' => $this->module)) && Tree::model()->exists('id<>:id AND module=:module', array(':id' => !$this->isNewRecord ? $this->id : 0, ':module' => $this->module))) {
$treeName = Tree::model()->find('module=:module', array(':module' => $this->module));
$this->addError($attribute, 'Модуль уже используется в разделе «' . $treeName->name . '»');
}
}
示例3: actionSetup
public function actionSetup()
{
$formSubmit = EnvUtil::submitCheck("formhash");
if ($formSubmit) {
$data =& $_POST;
foreach (array("sendemail", "sendsms", "sendmessage") as $field) {
if (!empty($data[$field])) {
$ids = array_keys($data[$field]);
$idstr = implode(",", $ids);
Notify::model()->updateAll(array($field => 1), sprintf("FIND_IN_SET(id,'%s')", $idstr));
Notify::model()->updateAll(array($field => 0), sprintf("NOT FIND_IN_SET(id,'%s')", $idstr));
} else {
Notify::model()->updateAll(array($field => 0));
}
}
CacheUtil::update("NotifyNode");
$this->success(Ibos::lang("Save succeed", "message"));
} else {
$nodeList = Notify::model()->getNodeList();
foreach ($nodeList as &$node) {
$node["moduleName"] = Module::model()->fetchNameByModule($node["module"]);
}
$this->render("setup", array("nodeList" => $nodeList));
}
}
示例4: fetchAllEnabledMenu
public function fetchAllEnabledMenu()
{
$allEnabledModules = Module::model()->fetchAllEnabledModule();
$enabledModStr = implode(",", array_keys($allEnabledModules));
$criteria = array("condition" => "(FIND_IN_SET(`module`, '{$enabledModStr}') OR iscustom=1) AND disabled=0", "order" => "`sort` ASC");
$menus = $this->fetchAllSortByPk("id", $criteria);
return $menus;
}
示例5: run
public function run()
{
//Yii::import('Xpress.models.Module');
$criteria = new CDbCriteria();
$criteria->condition = "enabled = true AND has_back_end = 'y'";
$criteria->order = 'ordering ASC';
$modules = Module::model()->findAll($criteria);
$this->render('module_backend_menus_system', array('modules' => $modules));
}
示例6: actionIndex
public function actionIndex()
{
$moduleId = $this->get('id', '');
$model = Module::model()->find('name = :name', array(':name' => $moduleId));
if ($model && $this->generateRoutes($moduleId)) {
$features = $this->getFeatures($moduleId);
}
$roles = AuthItem::model()->findAll('type = 2');
$this->render('index', array('model' => $model, 'features' => $features, 'roles' => $roles));
}
示例7: getModules
/**
* get all modules of system
* valid current module is exist
*
* @param string $module
*
* @return array
*/
protected function getModules($module)
{
$modules = Module::model()->findAll();
if (count($modules)) {
$modules = CHtml::listData($modules, 'name', 'friendly_name');
}
if (empty($module) === false && $module != 'system' && !array_key_exists($module, $modules)) {
throw new CHttpException(500, 'Invalid module');
}
return $modules;
}
示例8: testCreate
public function testCreate()
{
$model = new Module();
$model->crashreport_id = 1;
$model->name = 'user32.dll';
$model->file_version = '6.1.0.7600';
$model->sym_load_status = 0;
$model->loaded_debug_info_id = null;
$saved = $model->save();
$this->assertTrue($saved);
$model = Module::model()->find('name="user32.dll"');
$this->assertTrue($model != null);
}
示例9: init
protected function init()
{
$this->setLicence();
$this->_enabledModule = Module::model()->fetchAllEnabledModule();
foreach ($this->getEnabledModule() as $module) {
$config = CJSON::decode($module["config"], true);
if (isset($config["configure"]) && array_key_exists("modules", $config["configure"])) {
if (isset($config["behaviors"])) {
$this->setBehaviors($config["behaviors"]);
}
parent::configure($config["configure"]);
}
}
parent::init();
}
示例10: actionStatus
public function actionStatus()
{
$moduleStatus = EnvUtil::getRequest("type");
$module = EnvUtil::getRequest("module");
if (Ibos::app()->getRequest()->getIsAjaxRequest()) {
$status = 0;
if ($moduleStatus == "disabled") {
$status = 1;
}
$changeStatus = Module::model()->modify($module, array("disabled" => $status));
Nav::model()->updateAll(array("disabled" => $status), "module = :module", array(":module" => $module));
CacheUtil::update(array("setting", "nav"));
ModuleUtil::updateConfig($module);
$this->ajaxReturn(array("IsSuccess" => $changeStatus), "json");
}
}
示例11: getModulesByTeacher
public static function getModulesByTeacher($id){
$modules = Yii::app()->db->createCommand(array(
'select' => array('idModule'),
'from' => 'teacher_module',
'where' => 'idTeacher=:id',
'order' => 'idModule',
'params' => array(':id' => $id),
))->queryAll();
$count = count($modules);
for($i = 0;$i < $count;$i++){
$modules[$i]["title"] = Module::model()->findByPk($modules[$i]["idModule"])->module_name;
}
return (!empty($modules))?$modules:[];
}
示例12: actionSave
public function actionSave()
{
$q = $_POST['q'];
$arr = explode(";;", $q);
$num = 1;
foreach ($arr as $elem) {
$arrElem = explode("||", $elem);
$mod = Module::model()->findByPk($arrElem[0]);
$mod->name = $arrElem[1];
$mod->controller = $arrElem[2];
$mod->icon = $arrElem[3];
$mod->parent_id = $arrElem[4];
$mod->order = $num;
$mod->save();
$num++;
}
}
示例13: actionIndex
public function actionIndex()
{
$modules = Module::model()->fetchAllClientModule();
$widgetModule = $modules;
foreach ($widgetModule as $index => $module) {
$conf = CJSON::decode($module["config"]);
$param = $conf["param"];
if (!isset($param["indexShow"]) || !isset($param["indexShow"]["widget"])) {
unset($widgetModule[$index]);
}
}
$moduleArr = ConvertUtil::getSubByKey($widgetModule, "module");
$moduleSetting = MainUtil::execApiMethod("loadSetting", $moduleArr);
$data = array("modules" => $modules, "widgetModule" => $widgetModule, "moduleSetting" => CJSON::encode($moduleSetting), "menus" => MenuPersonal::model()->fetchMenuByUid(Ibos::app()->user->uid));
$this->setPageTitle(Ibos::lang("Home office"));
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Home office"))));
$this->render("index", $data);
}
示例14: fetchModules
function fetchModules()
{
$userLevelId = Yii::app()->user->userLevelId;
$arrIdParentModule = array();
// fetch parent id join with privilages
$criteria = new CDbCriteria();
$criteria->distinct = true;
$criteria->select = 't.p_id';
$criteria->join = 'LEFT JOIN module_privilage as mp ON t.id = mp.module_id';
$criteria->condition = 'mp.user_level_id = :userLevelId';
$criteria->params = array(":userLevelId" => $userLevelId);
$modules = Module::model()->findAll($criteria);
for ($x = 0; $x < count($modules); $x++) {
$arrIdParentModule[] = $modules[$x]->p_id;
}
// fetch parent
$criteria = new CDbCriteria();
$criteria->addInCondition('id', $arrIdParentModule, 'OR');
$modules = Module::model()->findAll($criteria);
return $modules;
}
示例15: actionPayNow
public function actionPayNow(){
if (!isset($_POST['module']) ) {
Yii::app()->user->setFlash('error', "<br>Будь-ласка, оберіть курс та модуль для оплати.");
$this->redirect(Yii::app()->request->urlReferrer);
}
$permission = new Permissions();
$lectures = Yii::app()->db->createCommand(array(
'select' => array('id'),
'from' => 'lectures',
'where' => 'idModule=:id',
'params' => array(':id'=>$_POST["module"]),
))->queryAll();
$count = count($lectures);
for($i = 0; $i < $count; $i++){
$permission->setRead($_POST['user'], $lectures[$i]["id"]);
}
Yii::app()->user->setFlash('pay', '<br /><h4>Вітаємо!</h4> Модуль <strong>'.
Module::model()->findByPk($_POST["module"])->module_name.'</strong> курса <strong>'.
Course::model()->findByPk($_POST['course'])->course_name.'</strong> оплачено.
<br />Тепер у Вас є доступ до усіх лекцій цього модуля. <h4>Enjoy it!</h4>');
$this->redirect(Yii::app()->request->urlReferrer);
}