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


PHP JRequest::getVar方法代码示例

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


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

示例1: featured

 /**
  * Method to toggle the featured setting of a list of articles.
  *
  * @return	void
  * @since	1.6
  */
 function featured()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Initialise variables.
     $user = JFactory::getUser();
     $ids = JRequest::getVar('cid', array(), '', 'array');
     $values = array('featured' => 1, 'unfeatured' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     // Access checks.
     foreach ($ids as $i => $id) {
         if (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) {
             // Prune items that you can't change.
             unset($ids[$i]);
             JError::raiseNotice(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Publish the items.
         if (!$model->featured($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         }
     }
     $this->setRedirect('index.php?option=com_content&view=articles');
 }
开发者ID:joomline,项目名称:Joomla2.5.999,代码行数:36,代码来源:articles.php

示例2: save

 function save()
 {
     $data = JRequest::getVar('jform', array(), 'post', 'NONE', 4);
     $id = (int) $data['id'];
     if (empty($id)) {
         if (!igGeneralHelper::authorise('core.igalleryfront.create')) {
             return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
         }
     } else {
         if (!igGeneralHelper::authorise('core.igalleryfront.edit', $id)) {
             return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
         }
     }
     $model = $this->getModel();
     $msg = '';
     if (!$model->save($data)) {
         JError::raise(2, 500, $model->getError());
     } else {
         $msg = JText::_('SUCCESSFULLY_SAVED');
     }
     switch ($this->task) {
         case 'apply':
             $url = 'index.php?option=com_igallery&view=icategory&id=' . $id;
             break;
         case 'save':
             $url = 'index.php?option=com_igallery&view=categories';
     }
     $this->setRedirect(JRoute::_($url, false), $msg);
 }
开发者ID:iFactoryDigital,项目名称:gympieradiology,代码行数:29,代码来源:icategory.php

示例3: __construct

 public function __construct($contentElement)
 {
     $this->filterNullValue = -1;
     $this->filterType = "category";
     $this->filterField = $contentElement->getFilter("category");
     parent::__construct($contentElement);
     // if currently selected category is not compatible with section then reset
     if (intval(JRequest::getVar('filter_reset', 0))) {
         $this->section_filter_value = -1;
     } else {
         if ($this->rememberValues) {
             $this->section_filter_value = JFactory::getApplication()->getUserStateFromRequest('section_filter_value', 'section_filter_value', -1);
         } else {
             $this->section_filter_value = JRequest::getVar("section_filter_value", -1);
         }
     }
     if ($this->section_filter_value != -1 and $this->filter_value >= 0) {
         $cat = JTable::getInstance('category');
         $cat->load($this->filter_value);
         if ($cat->section != $this->section_filter_value) {
             $this->filter_value = -1;
         }
     }
     if ($this->section_filter_value == 0) {
         $this->filter_value = 0;
     }
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:27,代码来源:category.php

示例4: display

 function display($tpl = null)
 {
     global $mainframe, $option;
     $cid = JRequest::getVar('cid_user');
     if (!is_array($cid)) {
         $mainframe->redirect('index.php?option=' . $option);
         return;
     }
     $user_id = $cid[0];
     $model = $this->getModel('user');
     $model->load($user_id);
     $this->_setToolBar();
     $say = JText::sprintf('USER_RESOURCES_TITLE', $model->user->username);
     $root_node = JText::_('RESOURCES_TREE_ROOT_NODE');
     $nowdate = JFactory::getDate();
     $str_now = JHTML::_('date', $nowdate->toMySQL(), '%Y-%m-%d %H:%M:%S');
     $this->assign('nowdate', $str_now);
     $this->assign('say', $say);
     $this->assign('root_node', $root_node);
     $this->assignRef('uid', $user_id);
     $this->assignRef('option', $option);
     //hide the menu
     JRequest::setVar('hidemainmenu', 1);
     parent::display();
 }
开发者ID:laiello,项目名称:yrm,代码行数:25,代码来源:view.resources.php

示例5: save

 /**
  * save function
  *
  * @return      nothing
  */
 public function save()
 {
     //$ids	= JRequest::getVar('cid', array(), '', 'array');
     // Get posted form variables.
     $task = $this->getTask();
     $data = JRequest::getVar('jform', array(), 'post', 'array');
     //echo "ECHO:: ".$data['id'];
     //  echo " task:: ".$task;
     $session =& JFactory::getSession();
     $articleid = $session->get('articleid');
     $fieldsattachid = $session->get('fieldsattachid');
     $model = $this->getModel();
     if (!$model->store()) {
         return JError::raiseWarning(500, $model->getError());
     }
     if ($task == "apply") {
         $msg = "";
         $lastid = $data['id'];
         if (empty($lastid)) {
             $lastid = $model->lastid;
         }
         $link = 'index.php?option=com_fieldsattach&view=fieldsattachimage&layout=edit&id=' . $lastid . '&tmpl=component&fieldsattachid=' . $fieldsattachid . '&reload=true';
         $this->setRedirect($link, $msg);
     }
     if ($task == "save") {
         $msg = "";
         //$link= 'index.php?option=com_fieldsattach&view=fieldsattachimages&tmpl=component&articleid='.$articleid.'&fieldsattachid='.$fieldsattachid.'&reset=1'  ;
         $link = 'index.php?option=com_fieldsattach&view=fieldsattachimages&tmpl=component&fieldsattachid=' . $fieldsattachid;
         $this->setRedirect($link, $msg);
     }
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:36,代码来源:fieldsattachimage.php

示例6: display

    public function display($tpl = null) {

        $document = & JFactory::getDocument();
        $document->addStyleSheet('components/com_gglms/css/lista.css');
        $document->addStyleSheet('components/com_gglms/css/jquery.dataTables.css');
        $document->addStyleSheet('components/com_gglms/css/jquery.dataTables_themeroller.css');
        $document->addScript('components/com_gglms/js/jquery.dataTables.js');


        $model = & $this->getModel();




        $tpl = JRequest::getVar('tpl');


        if ($tpl == "byContent") {
            $contentStat = $model->getContentStat();
            $this->assignRef('ContentStat', $contentStat);
        }

        if ($tpl == "byDate") {
            $AccesByDay = $model->getAccesByDay();
            $this->assignRef('AccesByDay', $AccesByDay);
        }

        parent::display($tpl);
    }
开发者ID:GGallery,项目名称:MDWEBTV-new,代码行数:29,代码来源:view.html.php

示例7: __construct

 function __construct()
 {
     $this->_mainframe = JFactory::getApplication();
     $this->_task = JRequest::getVar('task', 0);
     $this->_view = JRequest::getVar('view', 0);
     $this->_params = XiptFactory::getSettings('', 0);
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:7,代码来源:base.php

示例8: getListQuery

    /**
     * Method to get a JDatabaseQuery object for retrieving the data set from a database.
     *
     * @return	object	A JDatabaseQuery object to retrieve the data set.
     */
    protected function getListQuery()
    {
        $w = explode('|', urldecode(JRequest::getVar('filterStr', '')));
        $user = JFactory::getUser();
        $filterStr = $w[0];
        $filterAktiv = $w[1];
        if ($filterAktiv == 1) {
            $lezartLimit = 1;
        } else {
            $lezartLimit = 99;
        }
        if ($filterStr != '') {
            $filterStr = ' and sz.megnevezes like "%' . $filterStr . '%"';
        }
        $db = $this->getDbo();
        $query = $db->getQuery(true);
        $catid = (int) $this->getState('authorlist.id', 1);
        $query = '
/* szavazások amik jelenleg vita1 állapotban vannak */
/* ================================================ */
SELECT sz.megnevezes, sz.vita1, sz.vita2, sz.szavazas, sz.lezart, sz.szavazas_vege, sz.titkos, sz.vita2_vege,
  sz.id, sz.temakor_id
FROM #__szavazasok sz
WHERE (sz.vita2=1) ' . $filterStr;
        $query .= ' order by ' . JRequest::getVar('order', '6');
        return $query;
    }
开发者ID:madcsaba,项目名称:li-de,代码行数:32,代码来源:vita_too.php

示例9: getData

 function getData()
 {
     $cid = JRequest::getVar('cid');
     $row =& JTable::getInstance('K2UserGroup', 'Table');
     $row->load($cid);
     return $row;
 }
开发者ID:navinpai,项目名称:GEC-Tandav,代码行数:7,代码来源:usergroup.php

示例10: process

 function process()
 {
     if (!$this->isAllowed('lists', 'filter')) {
         return;
     }
     JRequest::checkToken() or die('Invalid Token');
     $filid = JRequest::getInt('filid');
     if (!empty($filid)) {
         $this->store();
     }
     $filterClass = acymailing_get('class.filter');
     $filterClass->subid = JRequest::getString('subid');
     $filterClass->execute(JRequest::getVar('filter'), JRequest::getVar('action'));
     if (!empty($filterClass->report)) {
         if (JRequest::getCmd('tmpl') == 'component') {
             echo acymailing_display($filterClass->report, 'info');
             $js = "setTimeout('redirect()',2000); function redirect(){window.top.location.href = 'index.php?option=com_acymailing&ctrl=subscriber'; }";
             $doc = JFactory::getDocument();
             $doc->addScriptDeclaration($js);
             return;
         } else {
             $app = JFactory::getApplication();
             foreach ($filterClass->report as $oneReport) {
                 $app->enqueueMessage($oneReport);
             }
         }
     }
     return $this->edit();
 }
开发者ID:unrealprojects,项目名称:journal,代码行数:29,代码来源:filter.php

示例11: delete

 /**
  * Removes an item
  */
 function delete()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Initialise variables.
     $user = JFactory::getUser();
     $ids = JRequest::getVar('cid', array(), '', 'array');
     // Access checks.
     foreach ($ids as $i => $id) {
         if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) {
             // Prune items that you can't delete.
             unset($ids[$i]);
             JError::raiseNotice(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Remove the items.
         if (!$model->featured($ids, 0)) {
             JError::raiseWarning(500, $model->getError());
         }
     }
     $this->setRedirect('index.php?option=com_content&view=featured');
 }
开发者ID:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:30,代码来源:featured.php

示例12: addImage

 /**
  * Adds an image to the list of the favourites
  *
  * @return  void
  * @since   1.5.5
  */
 public function addImage()
 {
     $model = $this->getModel('favourites');
     // Determine correct redirect URL
     if ($catid = JRequest::getInt('catid')) {
         // Request was initiated from category view
         $url = JRoute::_('index.php?view=category&catid=' . $catid, false);
     } elseif (($toplist = JRequest::getVar('toplist')) !== null) {
         // Request was initiated from toplist view
         if (empty($toplist)) {
             // Toplist view 'Most viewed'
             $url = JRoute::_('index.php?view=toplist', false);
         } else {
             // Any other toplist view
             $url = JRoute::_('index.php?view=toplist&type=' . $toplist, false);
         }
     } elseif (($sstring = JRequest::getVar('sstring')) !== null) {
         // Request was initiated from search view
         $url = JRoute::_('index.php?view=search&sstring=' . $sstring, false);
     } else {
         // Request was initiated from detail view or any other view
         $url = JRoute::_('index.php?view=detail&id=' . $model->getId(), false);
     }
     // Add the image to the list of favourite images
     if (!$model->addImage()) {
         $this->setRedirect($url, $model->getError(), 'error');
     } else {
         // Message is set by the model
         $this->setRedirect($url);
     }
 }
开发者ID:pabloarias,项目名称:JoomGallery,代码行数:37,代码来源:favourites.php

示例13: getOptions

 public function getOptions()
 {
     // Must load admin language files
     $lang = JFactory::getLanguage();
     $lang->load("com_jevents", JPATH_ADMINISTRATOR);
     $views = array();
     include_once JPATH_ADMINISTRATOR . "/components/com_jevents/jevents.defines.php";
     $exceptions_values = (string) $this->element['except'] ? (string) $this->element['except'] : "";
     $exceptions = array();
     $exceptions = explode(',', $exceptions_values);
     foreach (JEV_CommonFunctions::getJEventsViewList((string) $this->element["viewtype"]) as $viewfile) {
         if (in_array($viewfile, $exceptions)) {
             continue;
         }
         $views[] = JHTML::_('select.option', $viewfile, $viewfile);
     }
     sort($views);
     if ($this->menu != 'hide') {
         $task = JRequest::getVar('task');
         if ($task == "params.edit") {
             unset($views['global']);
         } else {
             array_unshift($views, JHTML::_('select.option', 'global', JText::_('USE_GLOBAL')));
         }
     }
     return $views;
 }
开发者ID:hriggs,项目名称:cs-website,代码行数:27,代码来源:jevview.php

示例14: import

 public function import()
 {
     $app = JFactory::getApplication();
     $model = F0FModel::getTmpInstance('Imports', 'AkeebasubsModel');
     $file = JRequest::getVar('csvfile', '', 'FILES');
     $delimiter = $this->input->getInt('csvdelimiters', 0);
     $field = $this->input->getString('field_delimiter', '');
     $enclosure = $this->input->getString('field_enclosure', '');
     if ($file['error']) {
         $this->setRedirect('index.php?option=com_akeebasubs&view=import', JText::_('COM_AKEEBASUBS_IMPORT_ERR_UPLOAD'), 'error');
         return true;
     }
     if ($delimiter != -99) {
         list($field, $enclosure) = $model->decodeDelimiterOptions($delimiter);
     }
     // Import ok, but maybe I have warnings (ie skipped lines)
     $result = $model->import($file['tmp_name'], $field, $enclosure);
     if ($result !== false) {
         $errors = $model->getErrors();
         if ($errors) {
             $app->enqueueMessage(JText::_('COM_AKEEBASUBS_IMPORT_WITH_WARNINGS'), 'notice');
             foreach ($errors as $error) {
                 $app->enqueueMessage($error, 'notice');
             }
         } else {
             // Import ok, congrat with yourself!
             $app->enqueueMessage(JText::sprintf('COM_AKEEBASUBS_IMPORT_OK', $result));
         }
     } else {
         //Uh oh... import failed, let's inform the user why it happened
         $app->enqueueMessage(JText::sprintf('COM_AKEEBASUBS_IMPORT_FAIL', $model->getError()), 'error');
     }
     $this->setRedirect('index.php?option=com_akeebasubs&view=import');
 }
开发者ID:ZoiaoDePeixe,项目名称:akeebasubs,代码行数:34,代码来源:imports.php

示例15: testGetVarFromDataSet

 /**
  * @dataProvider getVarData
  * @covers JRequest::getVar
  * @covers JRequest::_cleanVar
  * @covers JRequest::_stripSlashesRecursive
  */
 public function testGetVarFromDataSet($name, $default, $hash, $type, $mask, $expect, $filterCalls)
 {
     jimport('joomla.environment.request');
     $filter = JFilterInput::getInstance();
     $filter->mockReset();
     if (count($filterCalls)) {
         foreach ($filterCalls as $info) {
             $filter->mockSetUp($info[0], $info[1], $info[2], $info[3]);
         }
     }
     /*
      * Get the variable and check the value.
      */
     $actual = JRequest::getVar($name, $default, $hash, $type, $mask);
     $this->assertEquals($expect, $actual, 'Non-cached getVar');
     /*
      * Repeat the process to check caching (the JFilterInput mock should not
      * get called unless the default is being used).
      */
     $actual = JRequest::getVar($name, $default, $hash, $type, $mask);
     $this->assertEquals($expect, $actual, 'Cached getVar');
     if (($filterOK = $filter->mockTearDown()) !== true) {
         $this->fail('JFilterInput not called as expected:' . print_r($filterOK, true));
     }
 }
开发者ID:rvsjoen,项目名称:joomla-platform,代码行数:31,代码来源:JRequestGetVarTest.php


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