本文整理汇总了PHP中Joomla\Utilities\ArrayHelper类的典型用法代码示例。如果您正苦于以下问题:PHP ArrayHelper类的具体用法?PHP ArrayHelper怎么用?PHP ArrayHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArrayHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createThumbnail
/**
* Create a thumbnail from an image file.
*
* <code>
* $myFile = "/tmp/myfile.jpg";
*
* $options = array(
* "destination" => "image/mypic.jpg",
* "width" => 200,
* "height" => 200,
* "scale" => JImage::SCALE_INSIDE
* );
*
* $file = new PrismFileImage($myFile);
* $file->createThumbnail($options);
*
* </code>
*
* @param array $options Some options used in the process of generating thumbnail.
*
* @throws \InvalidArgumentException
* @throws \RuntimeException
*
* @return string A location to the new file.
*/
public function createThumbnail($options)
{
$width = ArrayHelper::getValue($options, "width", 100);
$height = ArrayHelper::getValue($options, "height", 100);
$scale = ArrayHelper::getValue($options, "scale", \JImage::SCALE_INSIDE);
$destination = ArrayHelper::getValue($options, "destination");
if (!$destination) {
throw new \InvalidArgumentException(\JText::_("LIB_PRISM_ERROR_INVALID_FILE_DESTINATION"));
}
// Generate thumbnail.
$image = new \JImage();
$image->loadFile($this->file);
if (!$image->isLoaded()) {
throw new \RuntimeException(\JText::sprintf('LIB_PRISM_ERROR_FILE_NOT_FOUND', $this->file));
}
// Resize the file as a new object
$thumb = $image->resize($width, $height, true, $scale);
$fileName = basename($this->file);
$ext = \JString::strtolower(\JFile::getExt(\JFile::makeSafe($fileName)));
switch ($ext) {
case "gif":
$type = IMAGETYPE_GIF;
break;
case "png":
$type = IMAGETYPE_PNG;
break;
case IMAGETYPE_JPEG:
default:
$type = IMAGETYPE_JPEG;
}
$thumb->toFile($destination, $type);
return $destination;
}
开发者ID:pashakiz,项目名称:crowdf,代码行数:58,代码来源:Image.php
示例2: featured
/**
* Method to toggle the featured setting of a list of contacts.
*
* @return void
*
* @since 1.6
*/
public function featured()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$ids = $this->input->get('cid', array(), 'array');
$values = array('featured' => 1, 'unfeatured' => 0);
$task = $this->getTask();
$value = ArrayHelper::getValue($values, $task, 0, 'int');
// Get the model.
/** @var ContactModelContact $model */
$model = $this->getModel();
// Access checks.
foreach ($ids as $i => $id) {
$item = $model->getItem($id);
if (!JFactory::getUser()->authorise('core.edit.state', 'com_contact.category.' . (int) $item->catid)) {
// 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::_('COM_CONTACT_NO_ITEM_SELECTED'));
} else {
// Publish the items.
if (!$model->featured($ids, $value)) {
JError::raiseWarning(500, $model->getError());
}
}
$this->setRedirect('index.php?option=com_contact&view=contacts');
}
开发者ID:adjaika,项目名称:J3Base,代码行数:37,代码来源:contacts.php
示例3: load
/**
* Load data about updates from database by project ID.
*
* <code>
* $options = array(
* "project_id" => 1, // It can also be an array with IDs.
* "period" => 7, // Period in days
* "limit" => 10 // Limit the results
* );
*
* $updates = new Crowdfunding\Updates(\JFactory::getDbo());
* $updates->load($options);
*
* foreach($updates as $item) {
* echo $item->title;
* echo $item->record_date;
* }
* </code>
*
* @param array $options
*/
public function load(array $options = array())
{
$query = $this->db->getQuery(true);
$query->select('a.id, a.title, a.description, a.record_date, a.project_id')->from($this->db->quoteName('#__crowdf_updates', 'a'));
// Filter by IDs.
$ids = ArrayHelper::getValue($options, 'ids', array(), 'array');
if (count($ids) > 0) {
$query->where('a.ids IN (' . implode(',', $ids) . ')');
}
// Filter by project ID.
$projectId = ArrayHelper::getValue($options, 'project_id', 0, 'int');
if ($projectId > 0) {
$query->where('a.project_id = ' . (int) $projectId);
}
// Filter by period.
$period = ArrayHelper::getValue($options, 'period', 0, 'int');
if ($period > 0) {
$query->where('a.record_date >= DATE_SUB(NOW(), INTERVAL ' . $period . ' DAY)');
}
// Set limit.
$limit = ArrayHelper::getValue($options, 'limit', 0, 'int');
if ($limit > 0) {
$this->db->setQuery($query, 0, $limit);
} else {
$this->db->setQuery($query);
}
$this->items = (array) $this->db->loadAssocList();
}
开发者ID:sis-direct,项目名称:CrowdFunding,代码行数:49,代码来源:Updates.php
示例4: renderListData
/**
* Shows the data formatted for the list view
*
* @param string $data Elements data
* @param stdClass &$thisRow All the data in the lists current row
* @param array $opts Rendering options
*
* @return string formatted value
*/
public function renderListData($data, stdClass &$thisRow, $opts = array())
{
$listModel = $this->getListModel();
$params = $this->getParams();
$w = (int) $params->get('fb_gm_table_mapwidth');
$h = (int) $params->get('fb_gm_table_mapheight');
$z = (int) $params->get('fb_gm_table_zoomlevel');
$data = FabrikWorker::JSONtoData($data, true);
foreach ($data as $i => &$d) {
if ($params->get('fb_gm_staticmap_tableview')) {
$d = $this->_staticMap($d, $w, $h, $z, $i, true, ArrayHelper::fromObject($thisRow));
}
if ($params->get('icon_folder') == '1' && ArrayHelper::getValue($opts, 'icon', 1)) {
// $$$ rob was returning here but that stopped us being able to use links and icons together
$d = $this->replaceWithIcons($d, 'list', $listModel->getTmpl());
} else {
if (!$params->get('fb_gm_staticmap_tableview')) {
$d = $params->get('fb_gm_staticmap_tableview_type_coords', 'num') == 'dms' ? $this->_dmsformat($d) : $this->_microformat($d);
}
}
if (ArrayHelper::getValue($opts, 'rollover', 1)) {
$d = $this->rollover($d, $thisRow, 'list');
}
if (ArrayHelper::getValue($opts, 'link', 1)) {
$d = $listModel->_addLink($d, $this, $thisRow, $i);
}
}
return $this->renderListDataFinal($data);
}
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:38,代码来源:googlemap.php
示例5: save
public function save($key = null, $urlVar = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$data = $this->input->post->get('jform', array(), 'array');
$itemId = ArrayHelper::getValue($data, "id");
$redirectData = array("task" => $this->getTask(), "id" => $itemId);
$model = $this->getModel();
/** @var $model GamificationModelRank */
$form = $model->getForm($data, false);
/** @var $form JForm */
if (!$form) {
throw new Exception(JText::_("COM_GAMIFICATION_ERROR_FORM_CANNOT_BE_LOADED"), 500);
}
// Validate the form
$validData = $model->validate($form, $data);
// Check for errors
if ($validData === false) {
$this->displayNotice($form->getErrors(), $redirectData);
return;
}
try {
$itemId = $model->save($validData);
$redirectData["id"] = $itemId;
} catch (Exception $e) {
JLog::add($e->getMessage());
throw new Exception(JText::_('COM_GAMIFICATION_ERROR_SYSTEM'));
}
$this->displayMessage(JText::_('COM_GAMIFICATION_LEVEL_SAVED'), $redirectData);
}
开发者ID:bellodox,项目名称:GamificationPlatform,代码行数:29,代码来源:level.php
示例6: array
/**
* Get the lists that contain events
*
* @return array
*/
public function &getEventLists()
{
if (is_null($this->eventLists)) {
$this->eventLists = array();
$db = FabrikWorker::getDbo(true);
$params = $this->getParams();
$lists = (array) $params->get('calendar_table');
$lists = ArrayHelper::toInteger($lists);
$dateFields = (array) $params->get('calendar_startdate_element');
$dateFields2 = (array) $params->get('calendar_enddate_element');
$labels = (array) $params->get('calendar_label_element');
$stati = (array) $params->get('status_element');
$colours = (array) $params->get('colour');
$query = $db->getQuery(true);
$query->select('id AS value, label AS text')->from('#__{package}_lists')->where('id IN (' . implode(',', $lists) . ')');
$db->setQuery($query);
$rows = $db->loadObjectList();
for ($i = 0; $i < count($rows); $i++) {
if (!isset($colours[$i])) {
$colours[$i] = '';
}
if (!isset($stati[$i])) {
$stati[$i] = '';
}
$rows[$i]->startdate_element = $dateFields[$i];
$rows[$i]->enddate_element = FArrayHelper::getValue($dateFields2, $i);
$rows[$i]->label_element = $labels[$i];
$rows[$i]->status = FArrayHelper::getValue($stati, $i, '');
$rows[$i]->colour = $colours[$i];
}
$this->eventLists = $rows;
}
return $this->eventLists;
}
开发者ID:glauberm,项目名称:cinevi,代码行数:39,代码来源:calendar.php
示例7: 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 $pks An array of primary key values to update. If not
* set the instance property value is used. [optional]
* @param integer $state The publishing state. eg. [0 = unpublished, 1 = published] [optional]
* @param integer $userId The user id of the user performing the operation. [optional]
*
* @return boolean True on success.
*
* @since 2.5
*/
public function publish($pks = null, $state = 1, $userId = 0)
{
$k = $this->_tbl_key;
// Sanitize input.
$pks = ArrayHelper::toInteger($pks);
$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;
}
}
// Build the WHERE clause for the primary keys.
$where = $k . '=' . implode(' OR ' . $k . '=', $pks);
// Update the publishing state for rows with the given primary keys.
$query = $this->_db->getQuery(true)->update($this->_db->quoteName($this->_tbl))->set($this->_db->quoteName('state') . ' = ' . (int) $state)->where($where);
$this->_db->setQuery($query);
try {
$this->_db->execute();
} catch (RuntimeException $e) {
$this->setError($e->getMessage());
return false;
}
// If the JTable instance value is in the list of primary keys that were set, set the instance.
if (in_array($this->{$k}, $pks)) {
$this->state = $state;
}
$this->setError('');
return true;
}
开发者ID:adjaika,项目名称:J3Base,代码行数:47,代码来源:map.php
示例8: fkData
/**
* Get the foreign keys value.
*
* @return mixed string|int
*/
protected function fkData()
{
if (!isset($this->fkData)) {
/** @var FabrikFEModelForm $formModel */
$formModel = $this->getModel();
$params = $this->getParams();
$this->fkData = array();
// Get the foreign key element
$fkElement = $this->fkElement();
if ($fkElement) {
$fkElementKey = $fkElement->getFullName();
$this->fkData = json_decode(FArrayHelper::getValue($formModel->formData, $fkElementKey));
if (is_object($this->fkData)) {
$this->fkData = ArrayHelper::fromObject($this->fkData);
}
$fkEval = $params->get('foreign_key_eval', '');
if ($fkEval !== '') {
$fkData = $this->fkData;
$eval = eval($fkEval);
if ($eval !== false) {
$this->fkData = $eval;
}
}
}
}
return $this->fkData;
}
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:32,代码来源:rest.php
示例9: load
/**
* Load transactions from database.
*
* <code>
* $options = array(
* "ids" => array(1,2,3),
* "txn_status" => "completed"
* );
*
* $transactions = new Crowdfunding\Transactions(\JFactory::getDbo());
* $transactions->load($options);
*
* foreach($transactions as $transaction) {
* echo $transaction->txn_id;
* echo $transaction->txn_amount;
* }
*
* </code>
*
* @param array $options
*
* @throws \UnexpectedValueException
*/
public function load($options = array())
{
$ids = !isset($options["ids"]) ? null : (array) $options["ids"];
if (!is_array($ids) or !$ids) {
return;
}
ArrayHelper::toInteger($ids);
// Load project data
$query = $this->db->getQuery(true);
$query->select("a.id, a.txn_date, a.txn_id, a.txn_amount, a.txn_currency, a.txn_status, " . "a.extra_data, a.status_reason, a.project_id, a.reward_id, a.investor_id, " . "a.receiver_id, a.service_provider, a.reward_state")->from($this->db->quoteName("#__crowdf_transactions", "a"))->where("a.id IN ( " . implode(",", $ids) . " )");
// Filter by status.
$status = ArrayHelper::getValue($options, "txn_status", null, "cmd");
if (!empty($status)) {
$query->where("a.txn_status = " . $this->db->quote($status));
}
$this->db->setQuery($query);
$results = $this->db->loadObjectList();
// Convert JSON string into an array.
if (!empty($results)) {
foreach ($results as $key => $result) {
if (!empty($result->extra_data)) {
$result->extra_data = json_decode($result->extra_data, true);
$results[$key] = $result;
}
}
} else {
$results = array();
}
$this->items = $results;
}
开发者ID:bharatthakkar,项目名称:CrowdFunding,代码行数:53,代码来源:Transactions.php
示例10: changeBlock
/**
* Method to change the block status on a record.
*
* @return void
*
* @since 1.6
*/
public function changeBlock()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$ids = $this->input->get('cid', array(), 'array');
$values = array('block' => 1, 'unblock' => 0);
$task = $this->getTask();
$value = ArrayHelper::getValue($values, $task, 0, 'int');
if (empty($ids)) {
JError::raiseWarning(500, JText::_('COM_USERS_USERS_NO_ITEM_SELECTED'));
} else {
// Get the model.
$model = $this->getModel();
// Change the state of the records.
if (!$model->block($ids, $value)) {
JError::raiseWarning(500, $model->getError());
} else {
if ($value == 1) {
$this->setMessage(JText::plural('COM_USERS_N_USERS_BLOCKED', count($ids)));
} elseif ($value == 0) {
$this->setMessage(JText::plural('COM_USERS_N_USERS_UNBLOCKED', count($ids)));
}
}
}
$this->setRedirect('index.php?option=com_users&view=users');
}
开发者ID:eshiol,项目名称:joomla-cms,代码行数:33,代码来源:users.php
示例11: setFieldSets
/**
* Set which fieldsets should be used
*
* @since 3.0.7
*
* @return array fieldset names
*/
private function setFieldSets()
{
$input = $this->app->input;
// From list data view in admin
$id = $input->getInt('listid', 0);
// From list of lists checkbox selection
$cid = $input->get('cid', array(0), 'array');
$cid = ArrayHelper::toInteger($cid);
if ($id === 0) {
$id = $cid[0];
}
if ($id !== 0) {
$db = FabrikWorker::getDbo();
$query = $db->getQuery(true);
$query->select('label')->from('#__{package}_lists')->where('id = ' . $id);
$db->setQuery($query);
$this->listName = $db->loadResult();
}
$fieldsets = array('details');
if ($this->model->canEmpty()) {
$fieldsets[] = 'drop';
}
$fieldsets[] = $id === 0 ? 'creation' : 'append';
$fieldsets[] = 'format';
return $fieldsets;
}
开发者ID:glauberm,项目名称:cinevi,代码行数:33,代码来源:view.html.php
示例12: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 3.6.0
*/
public function getOptions()
{
$lang = JFactory::getLanguage();
$options = array();
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select($db->quoteName('id', 'value'))->select($db->quoteName('title', 'text'))->from($db->quoteName('#__finder_types'));
// Get the options.
$db->setQuery($query);
try {
$contentTypes = $db->loadObjectList();
} catch (RuntimeException $e) {
JError::raiseWarning(500, $db->getMessage());
}
// Translate.
foreach ($contentTypes as $contentType) {
$key = FinderHelperLanguage::branchSingular($contentType->text);
$contentType->translatedText = $lang->hasKey($key) ? JText::_($key) : $contentType->text;
}
// Order by title.
$contentTypes = ArrayHelper::sortObjects($contentTypes, 'translatedText', 1, true, true);
// Convert the values to options.
foreach ($contentTypes as $contentType) {
$options[] = JHtml::_('select.option', $contentType->value, $contentType->translatedText);
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:35,代码来源:contenttypes.php
示例13: association
/**
* Render the list of associated items
*
* @param integer $catid Category identifier to search its associations
* @param string $extension Category Extension
*
* @return string The language HTML
*
* @since 3.2
* @throws Exception
*/
public static function association($catid, $extension = 'com_content')
{
// Defaults
$html = '';
// Get the associations
if ($associations = CategoriesHelper::getAssociations($catid, $extension)) {
$associations = ArrayHelper::toInteger($associations);
// Get the associated categories
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('c.id, c.title')->select('l.sef as lang_sef')->select('l.lang_code')->from('#__categories as c')->where('c.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON c.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (RuntimeException $e) {
throw new Exception($e->getMessage(), 500, $e);
}
if ($items) {
foreach ($items as &$item) {
$text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX';
$url = JRoute::_('index.php?option=com_categories&task=category.edit&id=' . (int) $item->id . '&extension=' . $extension);
$classes = 'hasPopover label label-association label-' . $item->lang_sef;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes . '" data-content="' . $item->title . '" data-placement="top">' . $text . '</a>';
}
}
JHtml::_('bootstrap.popover');
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
开发者ID:eshiol,项目名称:joomla-cms,代码行数:40,代码来源:categoriesadministrator.php
示例14: mapslist
/**
* Creates a list of maps.
*
* @return array An array containing the maps that can be selected.
*
* @since 2.5
*/
public static function mapslist()
{
$lang = JFactory::getLanguage();
// Load the finder types.
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select($db->quoteName('title', 'text'))->select($db->quoteName('id', 'value'))->from($db->quoteName('#__finder_taxonomy'))->where($db->quoteName('parent_id') . ' = 1');
$db->setQuery($query);
try {
$branches = $db->loadObjectList();
} catch (RuntimeException $e) {
JError::raiseWarning(500, $db->getMessage());
}
// Translate.
foreach ($branches as $branch) {
$key = FinderHelperLanguage::branchPlural($branch->text);
$branch->translatedText = $lang->hasKey($key) ? JText::_($key) : $branch->text;
}
// Order by title.
$branches = ArrayHelper::sortObjects($branches, 'translatedText', 1, true, true);
// Compile the options.
$options = array();
$options[] = JHtml::_('select.option', '', JText::_('COM_FINDER_MAPS_SELECT_BRANCH'));
// Convert the values to options.
foreach ($branches as $branch) {
$options[] = JHtml::_('select.option', $branch->value, $branch->translatedText);
}
return $options;
}
开发者ID:N6REJ,项目名称:joomla-cms,代码行数:35,代码来源:finder.php
示例15: getAmount
/**
* Generate a string of amount based on location.
* The method uses PHP NumberFormatter ( Internationalization Functions ).
* If the internationalization library is not loaded, the method generates a simple string ( 100 USD, 500 EUR,... )
*
* <code>
* $options = array(
* "intl" => true",
* "locale" => "en_GB",
* "symbol" => "£",
* "position" => 0 // 0 for symbol on the left side, 1 for symbole on the right side.
* );
*
* $amount = Prism\Utilities\StringHelper::getAmount(100, GBP, $options);
*
* echo $amount;
* </code>
*
* @param float $amount Amount value.
* @param string $currency Currency Code ( GBP, USD, EUR,...)
* @param array $options Options - "intl", "locale", "symbol",...
*
* @return string
*/
public static function getAmount($amount, $currency, array $options = array())
{
$useIntl = ArrayHelper::getValue($options, 'intl', false, 'bool');
$locale = ArrayHelper::getValue($options, 'locale');
$symbol = ArrayHelper::getValue($options, 'symbol');
$position = ArrayHelper::getValue($options, 'position', 0, 'int');
// Use PHP Intl library.
if ($useIntl and extension_loaded('intl')) {
// Generate currency string using PHP NumberFormatter ( Internationalization Functions )
// Get current locale code.
if (!$locale) {
$lang = \JFactory::getLanguage();
$locale = $lang->getName();
}
$numberFormat = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
$result = $numberFormat->formatCurrency($amount, $currency);
} else {
// Generate a custom currency string.
if (\JString::strlen($symbol) > 0) {
// Symbol
if (0 === $position) {
// Symbol at the beginning.
$result = $symbol . $amount;
} else {
// Symbol at end.
$result = $amount . $symbol;
}
} else {
// Code
$result = $amount . $currency;
}
}
return $result;
}
开发者ID:ITPrism,项目名称:SocialCommunityDistribution,代码行数:58,代码来源:StringHelper.php
示例16: getListQuery
/**
* Method to get a JDatabaseQuery object for retrieving the data set from a database.
*
* @return JDatabaseQuery A JDatabaseQuery object to retrieve the data set.
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$subQuery = $db->getQuery(true);
$includeRaw = $this->state->params->get('include_issues', null);
$excludeRaw = $this->state->params->get('exclude_issues', null);
$includeArray = explode(',', $includeRaw);
$excludeArray = explode(',', $excludeRaw);
$includeArray = ArrayHelper::toInteger($includeArray);
$excludeArray = ArrayHelper::toInteger($excludeArray);
$subQuery->select('it.issue_id AS issue_id, it.tag_id AS tag_id, t.tag AS tag')->join('LEFT', '#__code_tags AS t ON t.tag_id = it.tag_id')->from('#__code_tracker_issue_tag_map AS it')->where('it.tag_id IN (6,10,16,20,24,26,28,51,52,55,62,65,67,74,75,78,79,82,83,87,92,93,105,107,112,115)')->group('it.issue_id, it.tag_id, t.tag');
// Select required fields from the categories.
$query->select('CASE WHEN ISNULL(m.tag) THEN ' . $db->quote('None') . ' ELSE m.tag END as category');
$query->select('i.title, i.jc_issue_id, i.close_date');
$query->from('#__code_tracker_issues AS i');
$query->join('LEFT', '(' . (string) $subQuery . ') AS m ON i.jc_issue_id = m.issue_id');
$query->where('((DATE(close_date) BETWEEN ' . $db->quote(substr($this->state->params->get('start_date'), 0, 10)) . ' AND ' . $db->quote(substr($this->state->params->get('end_date'), 0, 10)) . ')' . ' OR (i.jc_issue_id IN (' . implode(',', $includeArray) . ')))');
// Join the status table to get the status name
$query->select('s.title AS status_name');
$query->join('LEFT', '#__code_tracker_status AS s ON i.status = s.jc_status_id');
// Filter on merged items from the trackers
$query->where('(s.title LIKE ' . $db->quote('%Fixed in SVN%') . ' OR s.title LIKE ' . $db->quote('%Implemented in trunk%') . ')');
// Exclude explicitly listed trackers
$query->where('i.jc_issue_id NOT IN (' . implode(',', $excludeArray) . ')');
if ($this->state->get('list.filter')) {
$query->where('i.title LIKE ' . $db->quote('%' . $this->state->get('list.filter') . '%'));
}
$query->order('CASE WHEN ISNULL(m.tag) THEN ' . $db->quote('None') . ' ELSE m.tag END ASC');
$query->order('i.jc_issue_id ASC');
return $query;
}
开发者ID:joomla-projects,项目名称:com_trackerstats,代码行数:38,代码来源:releasenotes.php
示例17: 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');
$uid = ArrayHelper::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)) {
JFactory::getCache('mod_menu')->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:eshiol,项目名称:joomla-cms,代码行数:39,代码来源:update.php
示例18: save
public function save($key = null, $urlVar = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$data = $this->input->post->get('jform', array(), 'array');
$itemId = ArrayHelper::getValue($data, 'id');
$responseOptions = array('task' => $this->getTask(), 'id' => $itemId);
$model = $this->getModel();
/** @var $model EmailTemplatesModelEmail */
$form = $model->getForm($data, false);
/** @var $form JForm */
if (!$form) {
throw new Exception(JText::_('COM_EMAILTEMPLATES_ERROR_FORM_CANNOT_BE_LOADED'));
}
// Validate the form data
$validData = $model->validate($form, $data);
// Check for errors
if ($validData === false) {
$this->displayNotice($form->getErrors(), $responseOptions);
return;
}
try {
$itemId = $model->save($validData);
$responseOptions['id'] = $itemId;
} catch (Exception $e) {
JLog::add($e->getMessage());
throw new Exception(JText::_('COM_EMAILTEMPLATES_ERROR_SYSTEM'));
}
$this->displayMessage(JText::_('COM_EMAILTEMPLATES_EMAIL_SAVED_SUCCESSFULLY'), $responseOptions);
}
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:29,代码来源:email.php
示例19: sticky_publish
/**
* Stick items
*
* @return void
*
* @since 1.6
*/
public function sticky_publish()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$ids = $this->input->get('cid', array(), 'array');
$values = array('sticky_publish' => 1, 'sticky_unpublish' => 0);
$task = $this->getTask();
$value = ArrayHelper::getValue($values, $task, 0, 'int');
if (empty($ids)) {
JError::raiseWarning(500, JText::_('COM_BANNERS_NO_BANNERS_SELECTED'));
} else {
// Get the model.
/** @var BannersModelBanner $model */
$model = $this->getModel();
// Change the state of the records.
if (!$model->stick($ids, $value)) {
JError::raiseWarning(500, $model->getError());
} else {
if ($value == 1) {
$ntext = 'COM_BANNERS_N_BANNERS_STUCK';
} else {
$ntext = 'COM_BANNERS_N_BANNERS_UNSTUCK';
}
$this->setMessage(JText::plural($ntext, count($ids)));
}
}
$this->setRedirect('index.php?option=com_banners&view=banners');
}
开发者ID:adjaika,项目名称:J3Base,代码行数:35,代码来源:banners.php
示例20: save
public function save($key = null, $urlVar = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
/** @var $app JApplicationAdministrator */
$data = $app->input->post->get('jform', array(), 'array');
$itemId = ArrayHelper::getValue($data, 'id');
$redirectOptions = array('task' => $this->getTask(), 'id' => $itemId);
$model = $this->getModel();
/** @var $model GamificationModelPoint */
$form = $model->getForm($data, false);
/** @var $form JForm */
if (!$form) {
throw new Exception(JText::_('COM_GAMIFICATION_ERROR_FORM_CANNOT_BE_LOADED'));
}
// Validate the form
$validData = $model->validate($form, $data);
// Check for errors.
if ($validData === false) {
$this->displayNotice($form->getErrors(), $redirectOptions);
return;
}
try {
$itemId = $model->save($validData);
$redirectOptions['id'] = $itemId;
} catch (Exception $e) {
JLog::add($e->getMessage(), JLog::ERROR, 'com_gamification');
throw new Exception(JText::_('COM_GAMIFICATION_ERROR_SYSTEM'));
}
$this->displayMessage(JText::_('COM_GAMIFICATION_POINTS_SAVED'), $redirectOptions);
}
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:31,代码来源:point.php
注:本文中的Joomla\Utilities\ArrayHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论