• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WM_Router类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: indexAction

 public function indexAction()
 {
     $where = '';
     $category = null;
     if ($this->getRequest()->getQuery('username')) {
         $userinfo = Model_Users::getByUsername($this->getRequest()->getQuery('username'));
         if ($userinfo) {
             $where = "users.username = '" . $this->getRequest()->getQuery('username') . "'";
         }
     }
     if ($this->getRequest()->getQuery('category')) {
         $catinfo = Model_Categories::get($this->getRequest()->getQuery('category'));
         if ($catinfo) {
             $category = $this->getRequest()->getQuery('category');
         }
     }
     $items = Model_Items::getAll($category, 0, 20, 'id desc', $where);
     $this->view->item = array();
     if ($items) {
         $model_images = new Model_Images();
         $categories = Model_Categories::get_all();
         foreach ($items as $item) {
             $categories_string = '';
             if ($category) {
                 foreach ($item['categories'] as $cats) {
                     if (in_array($category, $cats)) {
                         foreach ($cats as $cat) {
                             if (isset($categories[$cat]['name'])) {
                                 $categories_string .= $categories_string ? ' › ' : '';
                                 $categories_string .= $categories[$cat]['name'];
                             }
                         }
                         break;
                     }
                 }
             } else {
                 $cats = array_pop($item['categories']);
                 if ($cats && is_array($cats)) {
                     foreach ($cats as $cat) {
                         if (isset($categories[$cat]['name'])) {
                             $categories_string .= $categories_string ? ' › ' : '';
                             $categories_string .= $categories[$cat]['name'];
                         }
                     }
                 }
             }
             if ((int) JO_Registry::get($item['module'] . '_items_preview_width') && (int) JO_Registry::get($item['module'] . '_items_preview_height')) {
                 $item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resize($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width'), JO_Registry::forceGet($item['module'] . '_items_preview_height'), true);
             } elseif ((int) JO_Registry::get($item['module'] . '_items_preview_width')) {
                 $item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width'));
             } elseif ((int) JO_Registry::get($item['module'] . '_items_preview_height')) {
                 $item['theme_preview_thumbnail'] = $this->getRequest()->getBaseUrl() . $model_images->resizeHeight($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_height'));
             } else {
                 $item['theme_preview_thumbnail'] = false;
             }
             $this->view->item[] = array('title' => $item['name'], 'link' => WM_Router::create($this->getRequest()->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&item_id=' . $item['id']), 'description' => html_entity_decode($item['description'], ENT_QUOTES, 'utf-8'), 'author' => $item['username'], 'category' => $categories_string, 'guid' => $item['id'], 'enclosure' => $item['theme_preview_thumbnail'], 'pubDate' => JO_Date::getInstance($item['datetime'], JO_Date::RSS_FULL, true)->toString());
         }
     }
     echo $this->renderScript('rss');
 }
开发者ID:noikiy,项目名称:PD,代码行数:60,代码来源:RssController.php


示例2: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $this->noLayout(true);
     $this->view->baseUrl = $request->getBaseUrl();
     $this->view->bookmarklet = WM_Router::create($request->getBaseUrl() . '?controller=bookmarklet');
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:7,代码来源:PinitController.php


示例3: indexAction

 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
     $data = array('start' => $page * JO_Registry::get('admin_limit') - JO_Registry::get('admin_limit'), 'limit' => JO_Registry::get('admin_limit'));
     $this->view->collections = array();
     $collections = Model_Collections::getCollections($data);
     if ($collections) {
         foreach ($collections as $collection) {
             $collection['href'] = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=collections&action=view&collection_id=' . $collection['id']);
             $this->view->collections[] = $collection;
         }
     }
     $total_records = Model_Collections::getTotalCollections();
     $this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
     $this->view->total_rows = $total_records;
     $pagination = new Model_Pagination();
     $pagination->setLimit(JO_Registry::get('admin_limit'));
     $pagination->setPage($page);
     $pagination->setTotal($total_records);
     $pagination->setUrl($this->getRequest()->getModule() . '/collections/?page={page}');
     $this->view->pagination = $pagination->render();
 }
开发者ID:noikiy,项目名称:PD,代码行数:26,代码来源:CollectionsController.php


示例4: autocompleteAction

 public function autocompleteAction()
 {
     $request = $this->getRequest();
     $this->view->items = array();
     if (JO_Session::get('user[user_id]') && $request->getPost('value')) {
         $methods = glob(dirname(__FILE__) . '/Search/*.php');
         if ($methods) {
             foreach ($methods as $file) {
                 $controller = basename($file, '.php');
                 $class_name = 'Search_' . $controller;
                 if (!class_exists($class_name, false)) {
                     JO_Loader::loadFile($file);
                 }
                 $class = new $class_name();
                 if (method_exists($class, 'autocomplete')) {
                     $this->view->items = array_merge($this->view->items, $class->autocomplete($request->getPost('value')));
                 }
             }
         }
     }
     $this->view->items[] = array('template' => 'global', 'label' => sprintf($this->translate('Search for %s'), $request->getPost('value')), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=search&q=' . $request->getPost('value')));
     if ($request->isXmlHttpRequest()) {
         echo $this->renderScript('json');
     } else {
         $this->forward('error', 'error404');
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:27,代码来源:SearchController.php


示例5: indexAction

 public function indexAction()
 {
     $settings = Model_Extensions::getSettingsPairs('instagram');
     if (isset($settings['instagram_module_status_enable']) && $settings['instagram_module_status_enable']) {
         if (isset($settings['instagram_login_with_instagram']) && $settings['instagram_login_with_instagram']) {
             $request = $this->getRequest();
             $next = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_connect&action=connect');
             $this->view->instagram_connect_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_login&instagram_fnc=connect&action=forward&next=' . $next);
             $this->view->instagram_fetch = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_media');
             $connectObject = new Model_Instagram_Login();
             $user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
             $this->view->instagram_connect = false;
             $this->view->fetch_instagram_media = false;
             if ($user_info) {
                 $this->view->instagram_connect = true;
                 $this->view->fetch_instagram_media = isset($settings['instagram_fetch_instagram_media']) && $settings['instagram_fetch_instagram_media'];
             }
             $this->view->site_name = Helper_Config::get('site_name');
         } else {
             $this->noViewRenderer(true);
         }
     } else {
         $this->noViewRenderer(true);
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:25,代码来源:ConnectController.php


示例6: get_avatarAction

 public function get_avatarAction()
 {
     $this->noLayout(true);
     $request = $this->getRequest();
     if (JO_Session::get('user[user_id]')) {
         $connectObject = new Model_Facebook_Login();
         $user_info = $connectObject->getDataByUserId(JO_Session::get('user[user_id]'));
         $user_id = 0;
         if ($user_info) {
             $user_id = $user_info['oauth_uid'];
         } else {
             $facebookObject = new Helper_Modules_Facebook();
             $user_data = $facebookObject->getUser(true);
             if ($user_data && isset($user_data['id'])) {
                 $user_id = $user_data['id'];
             }
         }
         if ($user_id) {
             $ph = new WM_Facebook_Photo();
             $image = $ph->getRealUrl('http://graph.facebook.com/' . $user_id . '/picture?type=large');
             $image_info = @getimagesize($image);
             if ($image_info) {
                 $image_data = @file_get_contents($image);
                 if ($image_data) {
                     JO_Session::set('upload_avatar', array('name' => basename($image), 'type' => $image_info['mime'], 'data' => $image_data));
                     $this->view->success = WM_Router::create($request->getBaseUrl() . '?controller=settings&action=temporary_avatar&hash=' . microtime(true));
                 }
             }
         } else {
             $this->view->error = $this->translate('There is no established connection with facebook!');
         }
     }
     echo $this->renderScript('json');
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:34,代码来源:UseravatarController.php


示例7: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $goodies = Model_Pages::getPage(Helper_Config::get('page_goodies'));
     $pin_text = $this->translate('Pyng images from any website as you browse the web with the %s"Pyng It" button.%s');
     if ($goodies) {
         $this->view->pin_text = sprintf($pin_text, '<a href="' . WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . Helper_Config::get('page_goodies')) . '">', '</a>');
     }
     $methods = glob(dirname(__FILE__) . '/Addpin/*.php');
     $this->view->methods = array();
     if ($methods) {
         $front = $this->getFrontController();
         foreach ($methods as $row => $method) {
             $controller = basename($method, 'Controller.php');
             if ($controller) {
                 $name = $front->formatControllerName('addpin_' . strtolower($controller));
                 if (!class_exists($name, true)) {
                     JO_Loader::loadClass($name);
                 }
                 $instance = new $name();
                 $this->view->methods[isset($instance->SORT) ? $instance->SORT : 0] = $this->view->callChildren('addpin_' . strtolower($controller));
             }
         }
     }
     ksort($this->view->methods);
     $this->view->popup_main_box = $this->view->render('popup_main', 'addpin');
     if ($request->isXmlHttpRequest()) {
         $this->noViewRenderer(true);
         echo $this->view->popup_main_box;
     } else {
         $this->forward('error', 'error404');
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:33,代码来源:AddpinController.php


示例8: indexAction

 public function indexAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     if ($request->getRequest('type') !== 'create') {
         return;
     }
     $settings = Model_Extensions::getSettingsPairs('facebook');
     if (isset($settings['facebook_add_pin_to_facebook_timeline']) && $settings['facebook_add_pin_to_facebook_timeline']) {
         $user_id = $request->getParam('user');
         $pin_id = $request->getParam('pin');
         if ($user_id && $pin_id) {
             $connectObject = new Model_Facebook_Login();
             $user_fb = $connectObject->getDataByUserId($user_id);
             if ($user_fb && $user_fb['timeline']) {
                 $facebook = new Helper_Modules_Facebook();
                 $pin_url = WM_Router::pinAction($pin_id);
                 $params = array('link' => $pin_url, 'access_token' => $user_fb['access_token'], 'cb' => '');
                 $response = $facebook->facebook->api('/me/feed', 'post', $params);
                 if ($settings['facebook_og_namespace'] && $settings['facebook_og_recipe']) {
                     $params = array($settings['facebook_og_recipe'] => $pin_url, 'access_token' => $user_fb['access_token']);
                     $response1 = $facebook->facebook->api('/me/' . $settings['facebook_og_namespace'] . ':' . $settings['facebook_og_recipe'], 'post', $params);
                 }
             }
         }
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:27,代码来源:PinoncompleteController.php


示例9: indexAction

 public function indexAction()
 {
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
     $data = array('start' => $page * JO_Registry::get('admin_limit') - JO_Registry::get('admin_limit'), 'limit' => JO_Registry::get('admin_limit'));
     $this->view->comments = array();
     $comments = Model_Comments::getReportedComments($data);
     if ($comments) {
         $bbcode_parser = new WM_BBCode_Parser();
         $bbcode_parser->loadDefaultCodes();
         foreach ($comments as $comment) {
             $comment['href'] = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=items&action=comments&item_id=' . $comment['item_id'] . '&filter=' . ($comment['reply_to'] ? $comment['reply_to'] : $comment['id']));
             $bbcode_parser->parse($comment['comment']);
             $comment['comment'] = $bbcode_parser->getAsHtml();
             $this->view->comments[] = $comment;
         }
     }
     $total_records = Model_Comments::getTotalReportedComments($data);
     $this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
     $this->view->total_rows = $total_records;
     $pagination = new Model_Pagination();
     $pagination->setLimit(JO_Registry::get('admin_limit'));
     $pagination->setPage($page);
     $pagination->setTotal($total_records);
     $pagination->setUrl($this->getRequest()->getModule() . '/comments/?page={page}');
     $this->view->pagination = $pagination->render();
 }
开发者ID:noikiy,项目名称:PD,代码行数:30,代码来源:CommentsController.php


示例10: __construct

 public function __construct($key = null, $secret = null, $redirect_uri = null)
 {
     $this->key = $key ? $key : Helper_Config::get('instagram_oauth_key');
     $this->secret = $secret ? $secret : Helper_Config::get('instagram_oauth_secret');
     if (!$redirect_uri) {
         $redirect_uri = WM_Router::create(JO_Request::getInstance()->getBaseUrl() . '?controller=modules_instagram_login');
     }
     parent::__construct(array('client_id' => $this->key, 'client_secret' => $this->secret, 'grant_type' => 'authorization_code', 'redirect_uri' => $redirect_uri));
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:9,代码来源:Instagram.php


示例11: methodsforinvatesAction

 public function methodsforinvatesAction()
 {
     $request = $this->getRequest();
     //user invate friends
     $this->view->user_invate_friends = array();
     $this->view->user_invate_friends[] = array('title' => $this->translate('Email'), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=invates'), 'active' => $request->getController() == 'invates', 'class_icon' => 'icon-invites-email');
     $user_invate_friends = Model_Extensions::getByMethod('user_invate_friends');
     foreach ($user_invate_friends as $id => $method) {
         $this->view->user_invate_friends[] = array('title' => $this->translate(ucfirst(strtolower($method))), 'href' => WM_Router::create($request->getBaseUrl() . '?controller=modules_' . $method . '_invates'), 'active' => $request->getController() == 'modules_' . $method . '_invates', 'class_icon' => 'icon-invites-' . $method);
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:11,代码来源:InvatesController.php


示例12: pinitAction

 public function pinitAction()
 {
     $request = $this->getRequest();
     $this->noLayout(true);
     $this->view->baseUrl = $request->getBaseUrl();
     $this->view->bookmarklet = WM_Router::create($request->getBaseUrl() . '?controller=bookmarklet');
     $response = $this->getResponse();
     $response->addHeader('Cache-Control: no-cache, must-revalidate');
     $response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     $response->addHeader('Content-type: application/javascript');
 }
开发者ID:noikiy,项目名称:amatteur,代码行数:11,代码来源:JsController.php


示例13: autocomplete

 public function autocomplete($query)
 {
     $request = $this->getRequest();
     $result = array();
     $boards = new Model_Boards_SearchAutocomplete(array('filter_title' => $query, 'start' => 0, 'limit' => 100));
     if ($boards->count()) {
         foreach ($boards as $board) {
             $result[] = array('template' => 'board', 'title' => $board['board_title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board['board_user_id'] . '&board_id=' . $board['board_board_id']));
         }
     }
     return $result;
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:12,代码来源:BoardsController.php


示例14: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $settings = Model_Extensions::getSettingsPairs('facebook');
     if (!isset($settings['facebook_login_with_facebook']) || !$settings['facebook_login_with_facebook']) {
         $this->forward('error', 'error404');
     } elseif (!isset($settings['facebook_module_status_enable']) || !$settings['facebook_module_status_enable']) {
         $this->forward('error', 'error404');
     }
     $facebook = new Helper_Modules_Facebook();
     $user_data = $facebook->getUser(true);
     if ($user_data) {
         $modelLogin = new Model_Facebook_Login($user_data['id']);
         $error = true;
         if ($modelLogin->row) {
             $userObject = new Model_Users_User($modelLogin->row['user_id']);
             if ($userObject->count()) {
                 if (JO_Session::get('user[user_id]')) {
                     if ($modelLogin->row['user_id'] == JO_Session::get('user[user_id]')) {
                         JO_Session::set('user', $userObject->toArray());
                     }
                 } else {
                     JO_Session::set('user', $userObject->toArray());
                 }
                 new Model_Users_Edit($modelLogin->row['user_id'], array('last_login' => new JO_Db_Expr('NOW()')));
                 $modelLogin->facebook = $facebook;
                 $modelLogin->update($user_data);
                 if ($request->getQuery('next')) {
                     $this->redirect(urldecode($request->getQuery('next')));
                 } else {
                     $this->redirect(WM_Router::create($this->getRequest()->getBaseUrl()));
                 }
             }
         } elseif (Helper_Config::get('enable_free_registration')) {
             $this->forward('modules_facebook_register');
         } elseif (JO_Session::get('user[user_id]')) {
             $this->redirect($request->getBaseUrl());
         }
         $this->setViewChange('no_account');
         $page_login_trouble = Model_Pages::getPage(Helper_Config::get('page_login_trouble'));
         if ($page_login_trouble) {
             $this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
         }
     } else {
         //not session
         $this->setViewChange('error_login');
         $page_login_trouble = Model_Pages::getPage(Helper_Config::get('page_login_trouble'));
         if ($page_login_trouble) {
             $this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
         }
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:52,代码来源:LoginController.php


示例15: autocomplete

 public function autocomplete($query)
 {
     $request = $this->getRequest();
     $result = array();
     $has_friends = (int) JO_Session::get('user[following]') + (int) JO_Session::get('user[followers]');
     $users = $has_friends ? new Model_Users_SearchAutocomplete(array('filter_username' => $query, 'start' => 0, 'limit' => 100)) : new ArrayObject();
     if ($has_friends && $users->count()) {
         foreach ($users as $user) {
             $result[] = array('template' => 'user', 'avatars' => Helper_Uploadimages::userAvatars($user), 'fullname' => $user['fullname'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']));
         }
     }
     return $result;
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:13,代码来源:PeopleController.php


示例16: indexAction

 public function indexAction()
 {
     $this->view->usersCount = Model_Users::countUsers();
     $this->view->itemsCount = Model_Items::countItems();
     $pageID = $this->getRequest()->getRequest('page_id');
     $this->view->page = Model_Pages::get($pageID);
     if ($this->view->page['sub_of'] == 0) {
         $headPage = $this->view->page;
         $subPages = Model_Pages::getSubPages($pageID);
         //		if(!$subPages) {
         //			$this->view->usersCount = Model_Users::countUsers();
         //			$this->view->itemsCount = Model_Items::countItems();
         //		}
     } else {
         $headPage = Model_Pages::get($this->view->page['sub_of']);
         $subPages = Model_Pages::getSubPages($this->view->page['sub_of']);
         $crumbs = array();
         $parentPages = Model_Pages::getPageParents($this->view->page['sub_of']);
         if ($parentPages) {
             $cnt = count($parentPages);
             for ($i = 0; $i < $cnt; $i++) {
                 $crumbs[$i + 1] = array('name' => $parentPages[$i]['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $parentPages[$i]['id'] . '&name=' . WM_Router::clearName($parentPages[$i]['name'])));
             }
         }
     }
     $this->view->crumbs = array(array('name' => $this->view->translate('Home'), 'href' => $this->getRequest()->getBaseUrl()));
     if (isset($crumbs)) {
         $this->view->crumbs += $crumbs;
     }
     if ($subPages) {
         $this->view->subPages[] = array('name' => $headPage['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $headPage['id'] . '&name=' . WM_Router::clearName($headPage['name'])), 'is_selected' => $headPage['id'] == $pageID ? true : false);
         foreach ($subPages as $page) {
             $this->view->subPages[] = array('name' => $page['name'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&page_id=' . $page['id'] . '&name=' . WM_Router::clearName($page['name'])), 'is_selected' => $page['id'] == $pageID ? true : false);
         }
     }
     if (!$this->view->page) {
         $this->forward('error', 'error404');
     }
     $model_images = new Model_Images();
     $this->view->page['text'] = html_entity_decode($this->view->page['text'], ENT_QUOTES, 'utf-8');
     $this->view->page['text'] = $model_images->fixEditorText($this->view->page['text']);
     $this->getLayout()->meta_title = $this->view->page['meta_title'];
     $this->getLayout()->meta_description = $this->view->page['meta_description'];
     $this->getLayout()->meta_keywords = $this->view->page['meta_keywords'];
     $this->view->quiz_link = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=quiz');
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
开发者ID:noikiy,项目名称:PD,代码行数:49,代码来源:PagesController.php


示例17: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     if (!JO_Session::get('user_id')) {
         $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=login'));
     }
     if (JO_Session::get('msg_success')) {
         $this->view->msg_error = JO_Session::get('msg_success');
         JO_Session::clear('msg_success');
     }
     if (JO_Session::get('msg_error')) {
         $this->view->msg_error = JO_Session::get('msg_error');
         JO_Session::clear('msg_error');
     }
     $this->view->questions = $questions = Model_Quiz::getAllQuestions(0, 0, '', 'RAND()');
     $this->view->answers = $answers = Model_Quiz::getAllAnswers(0, 0, '', true);
     if ($request->isPost()) {
         $rightAnswers = 0;
         $user_answers = $request->getPost('answers');
         if (is_array($user_answers)) {
             foreach ($user_answers as $question => $answer) {
                 if (isset($answers[$question][$answer]) && $answers[$question][$answer]['right'] == 'true') {
                     $rightAnswers++;
                 }
             }
         }
         if ($rightAnswers > 0 && count($questions) == $rightAnswers) {
             $_SESSION['user']['quiz'] = 'true';
             JO_Session::set('quiz', 'true');
             Model_Users::updateQuiz(JO_Session::get('user_id'), 'true');
             JO_Session::set('msg_success', 'You have successfully completed the quiz');
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=upload'));
         } else {
             JO_Session::set('msg_error', 'You have to answer all questions correctly. You have ' . $rightAnswers . ' right answers from ' . $question . ' questions');
             $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=quiz'));
         }
     }
     $this->view->usersCount = Model_Users::countUsers();
     $this->view->itemsCount = Model_Items::countItems();
     $this->getLayout()->meta_title = $this->translate('Quiz');
     $this->getLayout()->meta_description = $this->translate('Quiz');
     $this->view->page_name = $this->translate('Quiz');
     /* CRUMBS */
     $this->view->crumbs = array();
     $this->view->crumbs[] = array('name' => $this->view->translate('Home'), 'href' => $request->getBaseUrl());
     $this->view->children = array();
     $this->view->children['header_part'] = 'layout/header_part';
     $this->view->children['footer_part'] = 'layout/footer_part';
 }
开发者ID:noikiy,项目名称:PD,代码行数:49,代码来源:QuizController.php


示例18: indexAction

 public function indexAction($next = null)
 {
     $this->noLayout(true);
     $settings = Model_Extensions::getSettingsPairs('twitter');
     if (isset($settings['twitter_module_status_enable']) && $settings['twitter_module_status_enable']) {
         if (isset($settings['twitter_login_with_twitter']) && $settings['twitter_login_with_twitter']) {
             $request = $this->getRequest();
             $this->view->login_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_twitter_login&action=forward&next=' . $next);
         } else {
             $this->noViewRenderer(true);
         }
     } else {
         $this->noViewRenderer(true);
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:15,代码来源:LoginbuttonController.php


示例19: indexAction

 public function indexAction($next = null)
 {
     $this->noLayout(true);
     $settings = Model_Extensions::getSettingsPairs('instagram');
     if (isset($settings['instagram_module_status_enable']) && $settings['instagram_module_status_enable']) {
         if (Helper_Config::get('enable_free_registration') && isset($settings['instagram_register_with_instagram']) && $settings['instagram_register_with_instagram']) {
             $request = $this->getRequest();
             $next = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_register');
             $this->view->login_url = WM_Router::create($request->getBaseUrl() . '?controller=modules_instagram_login&action=forward&instagram_fnc=register&next=' . $next);
         } else {
             $this->noViewRenderer(true);
         }
     } else {
         $this->noViewRenderer(true);
     }
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:16,代码来源:RegisterbuttonController.php


示例20: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $facebookCheck = new Model_Facebook_Login();
     $invate = $facebookCheck->checkInvateFacebook($request->getQuery('code'));
     if (!$invate) {
         $this->setViewChange('../login/no_account');
         $page_login_trouble = Model_Pages::getPage(JO_Registry::get('page_login_trouble'));
         if ($page_login_trouble) {
             $this->view->page_login_trouble = array('title' => $page_login_trouble['title'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page_login_trouble['page_id']));
         }
     } else {
         $facebookObject = new Helper_Modules_Facebook();
         $this->view->facebook_login_url = $facebookObject->getLoginUrl(null, 'modules_facebook_register');
     }
     $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
 }
开发者ID:NareshChennuri,项目名称:pyng,代码行数:17,代码来源:InvatedController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP WPBMap类代码示例发布时间:2022-05-23
下一篇:
PHP WFXMLHelper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap