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


PHP JArrayHelper::toInteger方法代码示例

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


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

示例1: delete

 public function delete()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to remove from the request.
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     if (!is_array($cid) || count($cid) < 1) {
         JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         jimport('joomla.utilities.arrayhelper');
         JArrayHelper::toInteger($cid);
         // Remove the items.
         if ($model->delete($cid)) {
             $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
         } else {
             $this->setMessage($model->getError());
         }
     }
     $version = new JVersion();
     if ($version->isCompatible('3.0')) {
         // Invoke the postDelete method to allow for the child class to access the model.
         $this->postDeleteHook($model, $cid);
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
开发者ID:AndreKoepke,项目名称:Einsatzkomponente,代码行数:28,代码来源:alarmierungsarten.php

示例2: selectnfredirect

 public function selectnfredirect()
 {
     // collect input data : which url needs to be redirected ?
     $notFoundUrlId = JRequest::getInt('notfound_url_id');
     // which URL to redirect to?
     $cid = JRequest::getVar('cid', array(0), 'default', 'array');
     JArrayHelper::toInteger($cid);
     if (count($cid) > 1) {
         // more than one target url selected, display error
         $this->setError(JText16::_('COM_SH404SEF_SELECT_ONLY_ONE_URL_TO_REDIRECT'));
         $this->display();
         return;
     }
     // only one url, use it
     $targetUrlId = $cid[0];
     if (empty($targetUrlId)) {
         // bad url, probably not an integer was passed
         $this->setError(JText16::_('COM_SH404SEF_INVALID_REDIRECT_TARGET_ID'));
         $this->display();
         return;
     }
     // get model and ask it to do the job
     $model =& $this->getModel($this->_defaultModel);
     $model->redirectNotFoundUrl($notFoundUrlId, $targetUrlId);
     // check errors
     $error = $model->getError();
     if (!empty($error)) {
         $this->setError($error);
     }
     // standard display
     $this->display();
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:32,代码来源:notfound.php

示例3: saveOrderAjax

	/**
	 * Method to save the submitted ordering values for records via AJAX.
	 *
	 * @return  void
	 *
	 * @since   3.0
	 */
	public function saveOrderAjax()
	{
		// Get the input
		$pks   = $this->input->post->get('cid', array(), 'array');
		$order = $this->input->post->get('order', array(), 'array');

		// Sanitize the input
		JArrayHelper::toInteger($pks);
		JArrayHelper::toInteger($order);

		// Get the model
		$model = $this->getModel();

		// Save the ordering
		
		$return = $model->saveorder($pks, $order);

		if ($return)
		{
			echo "1";
		}

		// Close the application
		JFactory::getApplication()->close();
	}
开发者ID:utopszkij,项目名称:lmp,代码行数:32,代码来源:naplos.php

示例4: populateState

 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication('administrator');
     // Adjust the context to support modal layouts.
     if ($layout = $app->input->get('layout', 'default', 'cmd')) {
         $this->context .= '.' . $layout;
     }
     // Load the filter state.
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $active = $this->getUserStateFromRequest($this->context . '.filter.active', 'filter_active');
     $this->setState('filter.active', $active);
     $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state');
     $this->setState('filter.state', $state);
     $groupId = $this->getUserStateFromRequest($this->context . '.filter.group', 'filter_group_id', null, 'int');
     $this->setState('filter.group_id', $groupId);
     $range = $this->getUserStateFromRequest($this->context . '.filter.range', 'filter_range');
     $this->setState('filter.range', $range);
     $groups = json_decode(base64_decode($app->input->get('groups', '', 'BASE64')));
     if (isset($groups)) {
         JArrayHelper::toInteger($groups);
     }
     $this->setState('filter.groups', $groups);
     $excluded = json_decode(base64_decode($app->input->get('excluded', '', 'BASE64')));
     if (isset($excluded)) {
         JArrayHelper::toInteger($excluded);
     }
     $this->setState('filter.excluded', $excluded);
     // Load the parameters.
     $params = JComponentHelper::getParams('com_users');
     $this->setState('params', $params);
     // List state information.
     parent::populateState('a.name', 'asc');
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:43,代码来源:users.php

示例5: toggleInList

 public function toggleInList()
 {
     // Check for request forgeries
     JRequest::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to publish from the request.
     $cid = JRequest::getVar('cid', array(), '', 'array');
     $data = array('showInListView' => 1, 'hideFromListView' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     if (empty($cid)) {
         JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         JArrayHelper::toInteger($cid);
         // Publish the items.
         if (!$model->addToListView($cid, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $ntext = $this->text_prefix . '_N_ITEMS_ADDED_TO_LIST_VIEW';
             } else {
                 $ntext = $this->text_prefix . '_N_ITEMS_REMOVED_FROM_LIST_VIEW';
             }
             $this->setMessage(JText::plural($ntext, count($cid)));
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:30,代码来源:elements.php

示例6: savesetting

 function savesetting()
 {
     $juser =& JFactory::getUser();
     if ($juser->guest) {
         $error = 'Bạn phải đăng nhập để thực hiện chức năng này';
         $this->setError($error);
         return false;
     }
     $post = JRequest::get('post');
     JArrayHelper::toInteger($post);
     $data = array();
     $data['user_id'] = $juser->id;
     $data['show_counter'] = $post['show_counter'] == 0 ? 0 : 1;
     $data['email_subscribe'] = $post['email_subscribe'] == 0 ? 0 : 1;
     $data['email_notify'] = $post['email_notify'] == 0 ? 0 : 1;
     $data['pre_check'] = $post['pre_check'] == 0 ? 0 : 1;
     $row =& $this->getTable('users');
     if (!$row->bind($data)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     return true;
 }
开发者ID:ngxuanmui,项目名称:hanhphuc.vn,代码行数:27,代码来源:profile.php

示例7: execute

 /**
  * Execute the controller.
  *
  * @return  void
  *
  * @since   3.1
  */
 public function execute()
 {
     // Get the application
     /* @var InstallationApplicationWeb $app */
     $app = $this->getApplication();
     // Check for request forgeries.
     JSession::checkToken() or $app->sendJsonResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
     // Get array of selected languages
     $lids = $this->input->get('cid', array(), 'array');
     JArrayHelper::toInteger($lids, array());
     // Get the languages model.
     $model = new InstallationModelLanguages();
     if (!$lids) {
         // No languages have been selected
         $app->enqueueMessage(JText::_('INSTL_LANGUAGES_NO_LANGUAGE_SELECTED'), 'warning');
     } else {
         // Install selected languages
         $model->install($lids);
         // Publish the Content Languages.
         $model->publishContentLanguages();
         $app->enqueueMessage(JText::_('INSTL_LANGUAGES_MORE_LANGUAGES'), 'notice');
     }
     // Redirect to the page.
     $r = new stdClass();
     $r->view = 'defaultlanguage';
     $app->sendJsonResponse($r);
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:34,代码来源:languages.php

示例8: categories

 /**
  * Returns an array of categories for the given extension.
  *
  * @param   string  $extension  The extension option.
  * @param   array   $config     An array of configuration options. By default, only published and unpublished categories are returned.
  *
  * @return  array   Categories for the extension
  *
  * @since   11.1
  */
 public function categories($extension, $config = array('filter.published' => array(0, 1)))
 {
     $config = (array) $config;
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id, a.title, a.level, a.parent_id');
     $query->from('#__categories AS a');
     $query->where('a.parent_id > 0');
     // Filter on extension.
     $query->where('extension = ' . $db->quote($extension));
     // Filter on the published state
     if (isset($config['filter.published'])) {
         if (is_numeric($config['filter.published'])) {
             $query->where('a.published = ' . (int) $config['filter.published']);
         } elseif (is_array($config['filter.published'])) {
             JArrayHelper::toInteger($config['filter.published']);
             $query->where('a.published IN (' . implode(',', $config['filter.published']) . ')');
         }
     }
     $query->order('a.lft');
     $db->setQuery($query);
     $items = $db->loadObjectList();
     $allitems = array();
     foreach ($items as &$item) {
         $repeat = $item->level - 1 >= 0 ? $item->level - 1 : 0;
         $item->title = str_repeat('- ', $repeat) . $item->title;
         $allitems[$item->id] = $item->title;
     }
     return $allitems;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:40,代码来源:CategoryPopulator.php

示例9: feature

 public function feature()
 {
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $cid = $app->input->post->get('documentid', array(), 'array');
     $data = array('feature' => 1, 'unfeature' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     $rootCat = JUDownloadFrontHelperCategory::getRootCategory();
     if (empty($cid)) {
         JError::raiseWarning(500, JText::_('COM_JUDOWNLOAD_NO_ITEM_SELECTED'));
     } else {
         $model = $this->getModel();
         JArrayHelper::toInteger($cid);
         if (!$model->feature($cid, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $ntext = $this->text_prefix . '_N_ITEMS_FEATURED';
             } elseif ($value == 0) {
                 $ntext = $this->text_prefix . '_N_ITEMS_UNFEATURED';
             }
             $this->setMessage(JText::plural($ntext, count($cid)));
         }
     }
     $extension = $app->input->get('extension');
     $extensionURL = $extension ? '&extension=' . $extension : '';
     $catURL = '&cat_id=' . $app->input->getInt('cat_id', $rootCat->id);
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $catURL . $extensionURL, false));
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:30,代码来源:documents.php

示例10: publish

 /**
  * Method to set the publishing state for a row or list of rows in the database
  * table.  The method respects checked out rows by other users and will attempt
  * to checkin rows that it can after adjustments are made.
  *
  * @param	mixed	An optional array of primary key values to update.  If not
  * 					set the instance property value is used.
  * @param	integer The publishing state. eg. [0 = unpublished, 1 = published, 2=archived, -2=trashed]
  * @param	integer The user id of the user performing the operation.
  *
  * @return	boolean	True on success.
  * @since	1.0
  */
 public function publish($pks = null, $state = 1, $userId = 0)
 {
     // Initialise variables.
     $k = $this->_tbl_key;
     // Sanitize input.
     JArrayHelper::toInteger($pks);
     $userId = (int) $userId;
     $state = (int) $state;
     // If there are no primary keys set check to see if the instance key is set.
     if (empty($pks)) {
         if ($this->{$k}) {
             $pks = array($this->{$k});
         } else {
             $this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
             return false;
         }
     }
     // Get an instance of the table
     $table = JTable::getInstance('List', 'NewsletterTable');
     // For all keys
     foreach ($pks as $pk) {
         // Load the banner
         if (!$table->load($pk)) {
             $this->setError($table->getError());
         }
         // Change the state
         $table->state = $state;
         // Store the row
         if (!$table->store()) {
             $this->setError($table->getError());
         }
     }
     return count($this->getErrors()) == 0;
 }
开发者ID:Rikisha,项目名称:proj,代码行数:47,代码来源:list.php

示例11: getArray

 public static function getArray($name, $default = array(), $type = 'array', $hash = 'default', $mask = 0)
 {
     // explode name
     $parts = explode('.', $name);
     if (count($parts) > 1) {
         $name = $parts[0];
         $key = $parts[1];
     }
     $array = self::getVar($name, $default, $hash, 'array', $mask);
     if (isset($key)) {
         if (is_array($array) && array_key_exists($key, $array)) {
             $value = $array[$key];
             settype($value, $type);
             return $value;
         }
         return $default;
     }
     if ($type == 'string') {
         JArrayHelper::toString($array);
     } else {
         if ($type == 'int') {
             JArrayHelper::toInteger($array);
         }
     }
     return $array;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:26,代码来源:request.php

示例12: setQueryConditions

    private function setQueryConditions(&$query)
    {
        $db = $this->getDBO();
        if ($this->getState('itemId')) {
            $query->leftJoin($db->quoteName('#__k2_tags_xref', 'xref') . ' ON ' . $db->quoteName('xref.tagId') . ' = ' . $db->quoteName('tag.id'));
            $query->where($db->quoteName('xref.itemId') . ' = ' . (int) $this->getState('itemId'));
        }
        if (is_numeric($this->getState('state'))) {
            $query->where($db->quoteName('tag.state') . ' = ' . (int) $this->getState('state'));
        }
        if ($this->getState('id')) {
            $id = $this->getState('id');
            if (is_array($id)) {
                JArrayHelper::toInteger($id);
                $query->where($db->quoteName('tag.id') . ' IN (' . implode(',', $id) . ')');
            } else {
                $query->where($db->quoteName('tag.id') . ' = ' . (int) $id);
            }
        }
        if ($this->getState('alias')) {
            $query->where($db->quoteName('tag.alias') . ' = ' . $db->quote($this->getState('alias')));
        }
        if ($this->getState('search')) {
            $search = JString::trim($this->getState('search'));
            $search = JString::strtolower($search);
            if ($search) {
                $search = $db->escape($search, true);
                $query->where('( LOWER(' . $db->quoteName('tag.name') . ') LIKE ' . $db->Quote('%' . $search . '%', false) . ' 
				OR ' . $db->quoteName('tag.id') . ' = ' . (int) $search . '  
				OR LOWER(' . $db->quoteName('tag.alias') . ') LIKE ' . $db->Quote('%' . $search . '%', false) . ')');
            }
        }
    }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:33,代码来源:tags.php

示例13: delete

 /**
  * Method to remove a record.
  */
 public function delete()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JInvalid_Token'));
     // Initialise variables.
     $user = JFactory::getUser();
     $ids = JRequest::getVar('cid', array(), '', 'array');
     if (!JFactory::getUser()->authorise('core.admin', $this->option)) {
         JError::raiseError(500, JText::_('JERROR_ALERTNOAUTHOR'));
         jexit();
     } elseif (empty($ids)) {
         JError::raiseWarning(500, JText::_('COM_USERS_NO_LEVELS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         JArrayHelper::toInteger($ids);
         // Remove the items.
         if (!$model->delete($ids)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             $this->setMessage(JText::plural('COM_USERS_N_LEVELS_DELETED', count($ids)));
         }
     }
     $this->setRedirect('index.php?option=com_users&view=levels');
 }
开发者ID:exntu,项目名称:joomla-cms,代码行数:28,代码来源:level.php

示例14: update

 /**
  * Update a set of extensions.
  *
  * @return  void
  *
  * @since   1.6
  */
 public function update()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     /** @var InstallerModelUpdate $model */
     $model = $this->getModel('update');
     $uid = $this->input->get('cid', array(), 'array');
     JArrayHelper::toInteger($uid, array());
     // Get the minimum stability.
     $component = JComponentHelper::getComponent('com_installer');
     $params = $component->params;
     $minimum_stability = $params->get('minimum_stability', JUpdater::STABILITY_STABLE, 'int');
     $model->update($uid, $minimum_stability);
     if ($model->getState('result', false)) {
         $cache = JFactory::getCache('mod_menu');
         $cache->clean();
     }
     $app = JFactory::getApplication();
     $redirect_url = $app->getUserState('com_installer.redirect_url');
     // Don't redirect to an external URL.
     if (!JUri::isInternal($redirect_url)) {
         $redirect_url = '';
     }
     if (empty($redirect_url)) {
         $redirect_url = JRoute::_('index.php?option=com_installer&view=update', false);
     } else {
         // Wipe out the user state when we're going to redirect.
         $app->setUserState('com_installer.redirect_url', '');
         $app->setUserState('com_installer.message', '');
         $app->setUserState('com_installer.extension_message', '');
     }
     $this->setRedirect($redirect_url);
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:40,代码来源:update.php

示例15: featured

 public function featured($pks, $value = 0)
 {
     // Sanitize the ids.
     $pks = (array) $pks;
     JArrayHelper::toInteger($pks);
     if (empty($pks)) {
         $this->setError(JText::_('COM_CONTACT_NO_ITEM_SELECTED'));
         return false;
     }
     $table = $this->getTable();
     try {
         $db = $this->getDbo();
         $query = $db->getQuery(true);
         $query->update('#__bookpro_tour');
         $query->set('featured = ' . (int) $value);
         $query->where('id IN (' . implode(',', $pks) . ')');
         $db->setQuery($query);
         $db->execute();
     } catch (Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     $table->reorder();
     // Clean component's cache
     $this->cleanCache();
     return true;
 }
开发者ID:hixbotay,项目名称:executivetransport,代码行数:27,代码来源:adtour.php


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