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


PHP cmsCore::getController方法代码示例

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


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

示例1: init

 public function init()
 {
     $photo = cmsCore::getController('photos');
     return array(array('type' => 'fieldset', 'title' => LANG_OPTIONS, 'childs' => array(new fieldCheckbox('options:auto_user', array('title' => LANG_PHOTOS_O_AUTO_USER, 'hint' => LANG_PHOTOS_O_AUTO_USER_HINT, 'default' => 1)), new fieldCheckbox('options:auto_group', array('title' => LANG_PHOTOS_O_AUTO_GROUP, 'hint' => LANG_PHOTOS_O_AUTO_GROUP_HINT, 'default' => 1)), new fieldCheckbox('options:auto_ctype_item', array('title' => LANG_PHOTOS_O_AUTO_CTYPE_ITEM, 'hint' => LANG_PHOTOS_O_AUTO_CTYPE_ITEM_HINT, 'default' => 1)), new fieldList('options:target', array('title' => LANG_PHOTOS_O_TARGET, 'items' => array(LANG_ALL, LANG_PHOTOS_PUBLIC_ALBUMS, LANG_PHOTOS_USER_ALBUMS), 'default' => 0)), new fieldList('options:album_id', array('title' => LANG_PHOTOS_ALBUM, 'generator' => function () {
         $_items = cmsCore::getModel('content')->limit(false)->disablePrivacyFilter()->getContentItemsForSitemap('albums', array('id', 'title'));
         $items = array('' => '');
         if ($_items) {
             foreach ($_items as $item) {
                 $items[$item['id']] = $item['title'];
             }
         }
         return $items;
     }, 'default' => '')), new fieldList('options:ordering', array('title' => LANG_SORTING, 'items' => array('' => '') + modelPhotos::getOrderList(), 'default' => '')), new fieldList('options:orientation', array('title' => LANG_PHOTOS_O_ORIENTATION, 'items' => modelPhotos::getOrientationList(), 'default' => '')), new fieldList('options:type', array('title' => LANG_PHOTOS_O_TYPE, 'items' => !empty($photo->options['types']) ? array('' => LANG_PHOTOS_ALL) + $photo->options['types'] : array(), 'default' => '')), new fieldNumber('options:width', array('title' => LANG_PHOTOS_SIZE_W . ', ' . mb_strtolower(LANG_PHOTOS_MORE_THAN), 'units' => 'px', 'default' => '')), new fieldNumber('options:height', array('title' => LANG_PHOTOS_SIZE_H . ', ' . mb_strtolower(LANG_PHOTOS_MORE_THAN), 'units' => 'px', 'default' => '')), new fieldNumber('options:limit', array('title' => LANG_LIST_LIMIT, 'default' => 10, 'rules' => array(array('required')))))));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:14,代码来源:options.form.php

示例2: getProfileMenu

 public function getProfileMenu($profile)
 {
     $menu = array(array('title' => LANG_USERS_PROFILE_INDEX, 'url' => href_to($this->name, $profile['id']), 'url_mask' => href_to($this->name, $profile['id'])));
     $this->tabs = $this->model->getUsersProfilesTabs(true, 'name');
     $this->tabs_controllers = array();
     if ($this->tabs) {
         foreach ($this->tabs as $tab) {
             $default_tab_info = array('title' => $tab['title'], 'url' => href_to($this->name, $profile['id'], $tab['name']));
             if (!$this->isControllerEnabled($tab['controller'])) {
                 continue;
             }
             if (empty($this->tabs_controllers[$tab['controller']])) {
                 $controller = cmsCore::getController($tab['controller'], $this->request);
             } else {
                 $controller = $this->tabs_controllers[$tab['controller']];
             }
             $tab_info = $controller->runHook('user_tab_info', array('profile' => $profile, 'tab_name' => $tab['name']));
             if ($tab_info == false) {
                 continue;
             } else {
                 if ($tab_info === true) {
                     $tab_info = $default_tab_info;
                 } else {
                     $tab_info = array_merge($default_tab_info, $tab_info);
                 }
             }
             $menu[] = $tab_info;
             $this->tabs_controllers[$tab['controller']] = $controller;
         }
     }
     return $menu;
 }
开发者ID:bitbybit,项目名称:icms2,代码行数:32,代码来源:frontend.php

示例3: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     $comment_id = $this->request->get('comment_id', 0);
     $score = $this->request->get('score', '');
     // Проверяем валидность
     $is_valid = is_numeric($comment_id) && in_array($score, array(-1, 1));
     if (!$is_valid) {
         $this->cms_template->renderJSON(array('error' => true));
     }
     $is_can_rate = cmsUser::isAllowed('comments', 'rate');
     if (!$is_can_rate) {
         $this->cms_template->renderJSON(array('error' => true));
     }
     $is_voted = $this->model->isUserVoted($comment_id, $this->cms_user->id);
     if ($is_voted) {
         $this->cms_template->renderJSON(array('error' => true));
     }
     $comment = $this->model->getComment($comment_id);
     if ($comment['user_id'] == $this->cms_user->id) {
         $this->cms_template->renderJSON(array('error' => true));
     }
     $success = $this->model->rateComment($comment_id, $this->cms_user->id, $score);
     if ($success && $comment['user_id'] && !empty($this->options['update_user_rating'])) {
         $rating = $this->model->getItemById('{users}', $comment['user_id']);
         $this->model->update('{users}', $comment['user_id'], array('rating' => $rating['rating'] + $score));
     }
     cmsCore::getController('activity')->addEntry($this->name, 'vote.comment', array('is_private' => (int) $comment['is_private'], 'subject_title' => $comment['target_title'], 'subject_id' => $comment_id, 'subject_url' => $comment['target_url'] . '#comment_' . $comment['id']));
     $this->cms_template->renderJSON(array('error' => !$success));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:32,代码来源:rate.php

示例4: run

 public function run($ctype_name = false)
 {
     $user = cmsUser::getInstance();
     $template = cmsTemplate::getInstance();
     $counts = $this->model->getTasksCounts($user->id);
     $is_moderator = $this->model->isUserModerator($user->id);
     if (!$is_moderator) {
         cmsCore::error404();
     }
     if (!$counts) {
         return $template->render('empty');
     }
     $is_index = false;
     $ctypes_list = array_keys($counts);
     if (!$ctype_name) {
         $ctype_name = $ctypes_list[0];
         $is_index = true;
     }
     $content_controller = cmsCore::getController('content');
     $ctypes = $content_controller->model->filterIn('name', $ctypes_list)->getContentTypesFiltered();
     $ctypes = array_collection_to_list($ctypes, 'name', 'title');
     $ctype = $content_controller->model->getContentTypeByName($ctype_name);
     $content_controller->model->filterByModeratorTask($user->id, $ctype_name);
     $page_url = $is_index ? href_to($this->name) : href_to($this->name, $ctype_name);
     $content_controller->model->disableApprovedFilter();
     $list_html = $content_controller->renderItemsList($ctype, $page_url, true);
     return $template->render('index', array('is_index' => $is_index, 'counts' => $counts, 'ctype' => $ctype, 'ctypes' => $ctypes, 'ctype_name' => $ctype_name, 'list_html' => $list_html, 'user' => $user));
 }
开发者ID:pin-git,项目名称:icms2,代码行数:28,代码来源:index.php

示例5: run

 public function run()
 {
     $form = $this->getForm('ctypes_basic', array('add'));
     $form = cmsEventsManager::hook('ctype_basic_form', $form);
     $is_submitted = $this->request->has('submit');
     $ctype = $form->parse($this->request, $is_submitted);
     if ($is_submitted) {
         $errors = $form->validate($this, $ctype);
         if (!$errors) {
             if (cmsCore::isControllerExists($ctype['name'])) {
                 $errors['name'] = LANG_CP_CTYPE_ERROR_NAME;
             }
         }
         if (!$errors) {
             $content_model = cmsCore::getModel('content');
             $ctype = cmsEventsManager::hook('ctype_before_add', $ctype);
             $ctype = cmsEventsManager::hook("ctype_{$ctype['name']}_before_add", $ctype);
             $ctype_id = $content_model->addContentType($ctype);
             $ctype['id'] = $ctype_id;
             cmsEventsManager::hook('ctype_after_add', $ctype);
             cmsEventsManager::hook("ctype_{$ctype['name']}_after_add", $ctype);
             if ($ctype_id) {
                 cmsCore::getController('content')->addWidgetsPages($ctype);
                 cmsUser::addSessionMessage(sprintf(LANG_CP_CTYPE_CREATED, $ctype['title']), 'success');
             }
             $this->redirectToAction('ctypes', array('labels', $ctype_id), array('wizard_mode' => true));
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return $this->cms_template->render('ctypes_basic', array('do' => 'add', 'ctype' => $ctype, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:33,代码来源:ctypes_add.php

示例6: run

 public function run($group)
 {
     if ($this->model->getMembership($group['id'], $this->cms_user->id)) {
         $this->redirectToAction($group['id']);
     }
     $invite = $this->model->getInvite($group['id'], $this->cms_user->id);
     if ($group['join_policy'] != groups::JOIN_POLICY_FREE && !$invite) {
         cmsCore::error404();
     }
     $result = cmsEventsManager::hook('group_before_join', array('allow' => true, 'group' => $group, 'invite' => $invite));
     if (!$result['allow']) {
         if (isset($result['access_text'])) {
             cmsUser::addSessionMessage($result['access_text'], 'error');
             if (isset($result['redirect_url'])) {
                 $this->redirect($result['redirect_url']);
             } else {
                 $this->redirectToAction($group['id']);
             }
         }
         cmsCore::error404();
     }
     $group = $result['group'];
     $invite = $result['invite'];
     $this->model->addMembership($group['id'], $this->cms_user->id);
     if ($invite) {
         $this->model->deleteInvite($invite['id']);
     }
     cmsCore::getController('activity')->addEntry($this->name, 'join', array('subject_title' => $group['title'], 'subject_id' => $group['id'], 'subject_url' => href_to_rel($this->name, $group['id']), 'group_id' => $group['id']));
     cmsUser::addSessionMessage(LANG_GROUPS_JOIN_MESSAGE, 'success');
     $this->redirectToAction($group['id']);
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:31,代码来源:group_join.php

示例7: processUpload

 public function processUpload($album_id)
 {
     $config = cmsConfig::getInstance();
     $uploader = new cmsUploader();
     $result = $uploader->upload('qqfile');
     if (!$result['success']) {
         cmsTemplate::getInstance()->renderJSON($result);
         $this->halt();
     }
     $preset = array('width' => 600, 'height' => 460, 'is_square' => false, 'is_watermark' => false);
     if (!empty($this->options['preset'])) {
         $preset = cmsCore::getModel('images')->getPresetByName($this->options['preset']);
     }
     $result['paths'] = array('big' => $uploader->resizeImage($result['path'], array('width' => $preset['width'], 'height' => $preset['height'], 'square' => $preset['is_square'])), 'normal' => $uploader->resizeImage($result['path'], array('width' => 160, 'height' => 160, 'square' => true)), 'small' => $uploader->resizeImage($result['path'], array('width' => 64, 'height' => 64, 'square' => true)), 'original' => $result['url']);
     if ($preset['is_watermark'] && !empty($preset['wm_image'])) {
         $images_controller = cmsCore::getController('images');
         $images_controller->addWatermark($result['paths']['big'], $preset['wm_image']['original'], $preset['wm_origin'], $preset['wm_margin']);
     }
     $result['filename'] = basename($result['path']);
     if (empty($this->options['is_origs'])) {
         @unlink($result['path']);
         unset($result['paths']['original']);
     }
     unset($result['path']);
     $result['url'] = $config->upload_host . '/' . $result['paths']['small'];
     $result['id'] = $this->model->addPhoto($album_id, $result['paths']);
     cmsTemplate::getInstance()->renderJSON($result);
     $this->halt();
 }
开发者ID:asphix,项目名称:icms2,代码行数:29,代码来源:upload.php

示例8: run

 public function run($id)
 {
     if (!$id) {
         cmsCore::error404();
     }
     $content_model = cmsCore::getModel('content');
     $ctype = $content_model->getContentType($id);
     $ctype = cmsEventsManager::hook("ctype_before_delete", $ctype);
     $content_model->deleteContentType($id);
     cmsEventsManager::hook("ctype_after_delete", $ctype);
     cmsCore::getModel('widgets')->deletePagesByName('content', "{$ctype['name']}.*");
     $binded_widgets = $content_model->get('widgets_bind', function ($item, $model) {
         $item['options'] = cmsModel::yamlToArray($item['options']);
         return $item;
     });
     if ($binded_widgets) {
         foreach ($binded_widgets as $widget) {
             if (isset($widget['options']['ctype_id']) && $ctype['id'] == $widget['options']['ctype_id']) {
                 $content_model->delete('widgets_bind', $widget['id']);
             }
         }
     }
     cmsCore::getController('activity')->deleteType('content', "add.{$ctype['name']}");
     $this->redirectToAction('ctypes');
 }
开发者ID:asphix,项目名称:icms2,代码行数:25,代码来源:ctypes_delete.php

示例9: run

 public function run($id)
 {
     if (!$id) {
         cmsCore::error404();
     }
     $users_model = cmsCore::getModel('users');
     $group = $users_model->getGroup($id);
     if (!$group) {
         cmsCore::error404();
     }
     $controllers = cmsPermissions::getControllersWithRules();
     $owners = array();
     foreach ($controllers as $controller_name) {
         $controller = cmsCore::getController($controller_name);
         $subjects = $controller->getPermissionsSubjects();
         $rules = cmsPermissions::getRulesList($controller_name);
         $values = array();
         foreach ($subjects as $subject) {
             $values[$subject['name']] = cmsPermissions::getPermissions($subject['name']);
         }
         $owners[$controller_name] = array('subjects' => $subjects, 'rules' => $rules, 'values' => $values);
     }
     $template = cmsTemplate::getInstance();
     $template->setMenuItems('users_group', array(array('title' => LANG_CONFIG, 'url' => href_to($this->name, 'users', array('group_edit', $id))), array('title' => LANG_PERMISSIONS, 'url' => href_to($this->name, 'users', array('group_perms', $id)))));
     return $template->render('users_group_perms', array('group' => $group, 'owners' => $owners));
 }
开发者ID:asphix,项目名称:icms2,代码行数:26,代码来源:users_group_perms.php

示例10: run

 public function run()
 {
     $new_values = $this->request->get('value', array());
     $group_id = $this->request->get('group_id', 0);
     if (!$new_values || !$group_id) {
         cmsCore::error404();
     }
     $controllers = cmsPermissions::getControllersWithRules();
     $owners = array();
     foreach ($controllers as $controller_name) {
         $controller = cmsCore::getController($controller_name);
         $subjects = $controller->getPermissionsSubjects();
         $rules = cmsPermissions::getRulesList($controller_name);
         $values = array();
         foreach ($subjects as $subject) {
             $values[$subject['name']] = cmsPermissions::getPermissions($subject['name']);
         }
         $owners[$controller_name] = array('subjects' => $subjects, 'rules' => $rules, 'values' => $values);
     }
     foreach ($owners as $controller_name => $controller) {
         foreach ($controller['subjects'] as $subject) {
             $formatted_values = array();
             foreach ($controller['rules'] as $rule) {
                 $value = isset($new_values[$rule['id']][$subject['name']]) ? $new_values[$rule['id']][$subject['name']] : null;
                 $formatted_values[$rule['id']][$group_id] = $value;
             }
             cmsPermissions::savePermissions($subject['name'], $formatted_values);
         }
     }
     cmsUser::addSessionMessage(LANG_CP_PERMISSIONS_SUCCESS, 'success');
     $this->redirectBack();
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:32,代码来源:users_group_perms_save.php

示例11: run

 public function run($user)
 {
     // Если пользователь отключил уведомления о новых комментариях
     // через личные сообщения, то выходим
     if (empty($user['notify_options']['comments_new'])) {
         return $user;
     }
     if (!in_array($user['notify_options']['comments_new'], array('pm', 'both'))) {
         return $user;
     }
     // Если новых комментариев на отслеживаемых страницах не появлялось
     // то тоже выходим
     $counts = $this->model->getTrackedNewCounts($user['id'], $user['date_log']);
     if (!$counts) {
         return $user;
     }
     $messenger = cmsCore::getController('messages');
     $messenger->addRecipient($user['id']);
     foreach ($counts as $data) {
         $spellcount = html_spellcount($data['count'], LANG_NEW_COMMENT1, LANG_NEW_COMMENT2, LANG_NEW_COMMENT10);
         $notice = array('content' => sprintf(LANG_COMMENTS_TRACKED_NEW, $data['target_title'], $spellcount), 'actions' => array('view' => array('title' => LANG_SHOW, 'href' => href_to($data['target_url']) . '?new_comments#comments'), 'stop' => array('title' => LANG_COMMENTS_TRACK_STOP, 'controller' => $this->name, 'action' => 'track_stop', 'params' => array($data['target_controller'], $data['target_subject'], $data['target_id']))));
         $messenger->sendNoticePM($notice, 'comments_new');
     }
     return $user;
 }
开发者ID:asphix,项目名称:icms2,代码行数:25,代码来源:user_login.php

示例12: run

 public function run()
 {
     if (cmsUser::isLogged()) {
         $this->redirectToHome();
     }
     $users_model = cmsCore::getModel('users');
     $form = $this->getForm('restore');
     $data = array();
     $is_submitted = $this->request->has('submit');
     if ($is_submitted) {
         $data = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $data);
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
         if (!$errors) {
             $user = $users_model->getUserByEmail($data['email']);
             if (!$user) {
                 cmsUser::addSessionMessage(LANG_EMAIL_NOT_FOUND, 'error');
             } else {
                 $pass_token = string_random(32, $user['email']);
                 $users_model->updateUserPassToken($user['id'], $pass_token);
                 $messenger = cmsCore::getController('messages');
                 $to = array('email' => $user['email'], 'name' => $user['nickname']);
                 $letter = array('name' => 'reg_restore');
                 $messenger->sendEmail($to, $letter, array('nickname' => $user['nickname'], 'page_url' => href_to_abs('auth', 'reset', $pass_token), 'valid_until' => html_date(date('d.m.Y H:i', time() + 24 * 3600), true)));
                 cmsUser::addSessionMessage(LANG_TOKEN_SENDED, 'success');
             }
         }
     }
     return cmsTemplate::getInstance()->render('restore', array('data' => $data, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:32,代码来源:restore.php

示例13: sendInvites

 private function sendInvites($profile, $emails_list)
 {
     $results = array('success' => array(), 'failed' => array());
     $emails = string_explode_list($emails_list);
     $auth_controller = cmsCore::getController('auth');
     $auth_model = cmsCore::getModel('auth');
     $messenger = cmsCore::getController('messages');
     foreach ($emails as $email) {
         if ($this->validate_email($email) !== true) {
             $results['failed'][$email] = ERR_VALIDATE_EMAIL;
             continue;
         }
         if ($this->model->getUserByEmail($email)) {
             $results['failed'][$email] = LANG_REG_EMAIL_EXISTS;
             continue;
         }
         if (!$auth_controller->isEmailAllowed($email)) {
             $results['failed'][$email] = LANG_AUTH_RESTRICTED_EMAILS;
             continue;
         }
         $invite = $auth_model->getNextInvite($this->cms_user->id);
         $to = array('email' => $email, 'name' => $email);
         $letter = array('name' => 'users_invite');
         $messenger->sendEmail($to, $letter, array('nickname' => $this->cms_user->nickname, 'code' => $invite['code'], 'page_url' => href_to_abs('auth', 'register') . "?inv={$invite['code']}"));
         $results['success'][$email] = true;
         $auth_model->markInviteSended($invite['id'], $this->cms_user->id, $email);
         if (sizeof($results['success']) + sizeof($results['failed']) >= $profile['invites_count']) {
             break;
         }
     }
     return $results;
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:32,代码来源:profile_invites.php

示例14: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     $orfo = $this->request->get('orfo');
     $url = $this->request->get('url');
     $comment = $this->request->get('comment', false);
     $author = !cmsUser::isLogged() ? cmsUser::getIp() : cmsUser::get('nickname');
     $form = $this->getForm('orfo');
     $is_submitted = $this->request->has('submit');
     if ($is_submitted) {
         $data = $form->parse($this->request, $is_submitted);
         $data['date'] = date('Y-m-d H:i:s');
         $errors = $form->validate($this, $data);
         dump($errors);
         if (!$errors) {
             $this->model->addComplaints($data);
             $messenger = cmsCore::getController('messages');
             $messenger->addRecipient(1);
             $notice = array('content' => sprintf(LANG_COMPLAINTS_ADD_NOTICE, $url, $orfo), 'options' => array('is_closeable' => true));
             $messenger->ignoreNotifyOptions()->sendNoticePM($notice, 'complaints_add');
         }
         cmsTemplate::getInstance()->renderJSON(array('errors' => false, 'callback' => 'formSuccess'));
     }
     $data = array('orfo' => $orfo, 'url' => $url, 'author' => $author, 'comment' => $comment);
     return cmsTemplate::getInstance()->render('orfo', array('form' => $form, 'data' => $data));
 }
开发者ID:mafru,项目名称:icms2,代码行数:28,代码来源:orfo.php

示例15: run

 public function run($group)
 {
     $activity_controller = cmsCore::getController('activity', $this->request);
     $activity_controller->model->filterEqual('group_id', $group['id']);
     $page_url = href_to($this->name, $group['id'], 'activity');
     $html = $activity_controller->renderActivityList($page_url);
     return cmsTemplate::getInstance()->render('group_activity', array('user' => $this->cms_user, 'group' => $group, 'html' => $html));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:8,代码来源:group_activity.php


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