本文整理汇总了PHP中JError::raiseNotice方法的典型用法代码示例。如果您正苦于以下问题:PHP JError::raiseNotice方法的具体用法?PHP JError::raiseNotice怎么用?PHP JError::raiseNotice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JError
的用法示例。
在下文中一共展示了JError::raiseNotice方法的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');
}
示例2: doimport
function doimport()
{
$model =& $this->getModel('Importcsv');
$tableModel =& $model->getTableModel();
$table =& $tableModel->getTable();
if (!$tableModel->canCSVImport()) {
JError::raiseError(400, 'Naughty naughty!');
jexit;
}
$tmp_file = $model->checkUpload();
if ($tmp_file === false) {
$this->display();
}
$model->readCSV($tmp_file);
$model->findExistingElements();
$document =& JFactory::getDocument();
$viewName = JRequest::getVar('view', 'form', 'default', 'cmd');
$viewType = $document->getType();
// Set the default view name from the Request
$view =& $this->getView($viewName, $viewType);
$Itemid = JRequest::getInt('Itemid');
if (!empty($model->newHeadings)) {
//as opposed to admin you can't alter table structure with a CSV import
//from the front end
JError::raiseNotice(500, $model->_makeError());
$this->setRedirect("index.php?option=com_fabrik&c=import&view=import&fietype=csv&tableid=" . $table->id . "&Itemid=" . $Itemid);
} else {
JRequest::setVar('fabrik_table', $table->id);
$msg = $model->makeTableFromCSV();
$this->setRedirect('index.php?option=com_fabrik&view=table&tableid=' . $table->id . "&Itemid=" . $Itemid, $msg);
}
}
示例3: admin_postinstall_eaccelerator_action
/**
* Disables the unsupported eAccelerator caching method, replacing it with the
* "file" caching method.
*
* @return void
*
* @since 3.2
*/
function admin_postinstall_eaccelerator_action()
{
$prev = new JConfig();
$prev = JArrayHelper::fromObject($prev);
$data = array('cacheHandler' => 'file');
$data = array_merge($prev, $data);
$config = new Registry('config');
$config->loadArray($data);
jimport('joomla.filesystem.path');
jimport('joomla.filesystem.file');
// Set the configuration file path.
$file = JPATH_CONFIGURATION . '/configuration.php';
// Get the new FTP credentials.
$ftp = JClientHelper::getCredentials('ftp', true);
// Attempt to make the file writeable if using FTP.
if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
}
// Attempt to write the configuration file as a PHP class named JConfig.
$configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
if (!JFile::write($file, $configuration)) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
return;
}
// Attempt to make the file unwriteable if using FTP.
if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
}
}
示例4: updateAll
/**
* Method to upgrade all registered packages at once
*
* @package MageBridge
* @access public
* @param int $allow_update
* @return bool
*/
public function updateAll($allow_update = array())
{
// Fetch all the available packages
$packages = MageBridgeUpdateHelper::getPackageList();
$count = 0;
foreach ($packages as $package) {
// Skip optional packages which are not yet installed and not selected in the list
if (!in_array($package['name'], $allow_update)) {
continue;
}
// Skip packages that are not available
if ($package['available'] == 0) {
continue;
}
// Update the package and add an error if something goes wrong
if ($this->update($package['name']) == false) {
JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('COM_MAGEBRIDGE_MODEL_UPDATE_INSTALL_FAILED', $package['name']));
// Only crash when installing the component, continue for all other extensions
if ($package['name'] == 'com_magebridge') {
return false;
}
continue;
} else {
$count++;
}
}
// Run the helper to remove obsolete files
YireoHelperInstall::remove();
// Simple notices as feedback
JError::raiseNotice('SOME_ERROR_CODE', JText::sprintf('COM_MAGEBRIDGE_MODEL_UPDATE_INSTALL_SUCCESS', $count));
JError::raiseNotice('SOME_ERROR_CODE', JText::sprintf('COM_MAGEBRIDGE_MODEL_UPDATE_INSTALL_CHANGELOG', MageBridgeHelper::getHelpLink('changelog')));
return true;
}
示例5: doimport
function doimport()
{
$model =& $this->getModel('Importcsv', 'FabrikFEModel');
if (!$model->import()) {
$this->display();
return;
}
$id = $model->getListModel()->getId();
$document = JFactory::getDocument();
$viewName = JRequest::getVar('view', 'form', 'default', 'cmd');
$viewType = $document->getType();
// Set the default view name from the Request
$view =& $this->getView($viewName, $viewType);
$Itemid = JRequest::getInt('Itemid');
if (!empty($model->newHeadings)) {
//as opposed to admin you can't alter table structure with a CSV import
//from the front end
JError::raiseNotice(500, $model->_makeError());
$this->setRedirect("index.php?option=com_fabrik&view=import&fietype=csv&listid=" . $id . "&Itemid=" . $Itemid);
} else {
JRequest::setVar('fabrik_list', $id);
$msg = $model->makeTableFromCSV();
$this->setRedirect('index.php?option=com_fabrik&view=list&listid=' . $id . "&resetfilters=1&Itemid=" . $Itemid, $msg);
}
}
示例6: _process
/**
* Clone the record
*
* @param object $params plugin params
* @param object &$formModel form model
*
* @return bool
*/
private function _process($params, &$formModel)
{
$clone_times_field_id = $params->get('clone_times_field', '');
$clone_batchid_field_id = $params->get('clone_batchid_field', '');
if ($clone_times_field_id != '') {
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_times_field_id);
$element = $elementModel->getElement(true);
if ($clone_batchid_field_id != '') {
$elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_batchid_field_id);
$id_element = $id_elementModel->getElement(true);
$formModel->_formData[$id_element->name] = $formModel->_fullFormData['rowid'];
$formModel->_formData[$id_element->name . '_raw'] = $formModel->_fullFormData['rowid'];
$listModel = $formModel->getlistModel();
$listModel->_oForm = $formModel;
$primaryKey = FabrikString::shortColName($listModel->getTable()->db_primary_key);
$formModel->_formData[$primaryKey] = $formModel->_fullFormData['rowid'];
$formModel->_formData[$primaryKey . '_raw'] = $formModel->_fullFormData['rowid'];
$listModel->storeRow($formModel->_formData, $formModel->_fullFormData['rowid']);
}
// $clone_times_field = $elementModel->getFullName(false, true, false);
$clone_times = $formModel->_formData[$element->name];
if (is_numeric($clone_times)) {
$clone_times = (int) $clone_times;
$formModel->_formData['Copy'] = 1;
for ($x = 1; $x < $clone_times; $x++) {
$formModel->processToDB();
}
return true;
}
}
JError::raiseNotice(JText::_('CLONEERR'), "Couldn't find a valid number of times to clone!");
return true;
}
示例7: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$access = JFactory::getACL();
// Include user in groups that have access to edit their articles, other articles, or manage content.
$action = array('com_content.article.edit_own', 'com_content.article.edit_article', 'com_content.manage');
$groups = $access->getAuthorisedUsergroups($action, true);
// Check the results of the access check.
if (!$groups) {
return false;
}
// Clean up and serialize.
JArrayHelper::toInteger($groups);
$groups = implode(',', $groups);
// Build the query to get the users.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('u.id AS value');
$query->select('u.name AS text');
$query->from('#__users AS u');
$query->join('INNER', '#__user_usergroup_map AS m ON m.user_id = u.id');
$query->where('u.block = 0');
$query->where('m.group_id IN (' . $groups . ')');
// Get the users.
$db->setQuery((string) $query);
$users = $db->loadObjectList();
// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseNotice(500, $db->getErrorMsg());
return false;
}
return JHtml::_('select.genericlist', $users, $name, 'class="inputbox" size="1"', 'value', 'text', $value);
}
示例8: groups
/**
* Displays a list of user groups.
*
* @param boolean true to include super admin groups, false to exclude them
*
* @return array An array containing a list of user groups.
*
* @since 11.4
*/
public static function groups($includeSuperAdmin = false)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level');
$query->from($db->quoteName('#__usergroups') . ' AS a');
$query->join('LEFT', $db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
$query->group('a.id, a.title, a.lft, a.rgt');
$query->order('a.lft ASC');
$db->setQuery($query);
$options = $db->loadObjectList();
// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseNotice(500, $db->getErrorMsg());
return null;
}
for ($i = 0, $n = count($options); $i < $n; $i++) {
$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
$groups[] = JHtml::_('select.option', $options[$i]->value, $options[$i]->text);
}
// Exclude super admin groups if requested
if (!$includeSuperAdmin) {
$filteredGroups = array();
foreach ($groups as $group) {
if (!JAccess::checkGroup($group->value, 'core.admin')) {
$filteredGroups[] = $group;
}
}
$groups = $filteredGroups;
}
return $groups;
}
示例9: setDate
/**
* Method to set the date
*
* @access public
* @param string
*/
function setDate($date)
{
$app = JFactory::getApplication();
# Get the params of the active menu item
$params = $app->getParams('com_jem');
# 0 means we have a direct request from a menuitem and without any params (eg: calendar module)
if ($date == 0) {
$dayoffset = $params->get('days');
$timestamp = mktime(0, 0, 0, date("m"), date("d") + $dayoffset, date("Y"));
$date = strftime('%Y-%m-%d', $timestamp);
# a valid date has 8 characters (ymd)
} elseif (strlen($date) == 8) {
$year = substr($date, 0, -4);
$month = substr($date, 4, -2);
$tag = substr($date, 6);
//check if date is valid
if (checkdate($month, $tag, $year)) {
$date = $year.'-'.$month.'-'.$tag;
} else {
//date isn't valid raise notice and use current date
$date = date('Ymd');
JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_JEM_INVALID_DATE_REQUESTED_USING_CURRENT'));
}
} else {
//date isn't valid raise notice and use current date
$date = date('Ymd');
JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_JEM_INVALID_DATE_REQUESTED_USING_CURRENT'));
}
$this->_date = $date;
}
示例10: display
/**
* Image selection List
*
*/
function display($tpl = null) {
$app = JFactory::getApplication();
$option = $app->input->getString('option', 'com_jem');
JHtml::_('behavior.framework');
if($this->getLayout() == 'uploadimage') {
$this->_displayuploadimage($tpl);
return;
}
//get vars
$task = $app->input->get('task', '');
$search = $app->getUserStateFromRequest($option.'.filter_search', 'filter_search', '', 'string');
$search = trim(JString::strtolower($search));
//set variables
if ($task == 'selecteventimg') {
$folder = 'events';
$task = 'eventimg';
$redi = 'selecteventimg';
} else if ($task == 'selectvenueimg') {
$folder = 'venues';
$task = 'venueimg';
$redi = 'selectvenueimg';
} else if ($task == 'selectcategoriesimg') {
$folder = 'categories';
$task = 'categoriesimg';
$redi = 'selectcategoriesimg';
}
$app->input->set('folder', $folder);
// Do not allow cache
JResponse::allowCache(false);
// Load css
JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
//get images
$images = $this->get('images');
$pagination = $this->get('Pagination');
if (count($images) > 0 || $search) {
$this->images = $images;
$this->folder = $folder;
$this->task = $redi;
$this->search = $search;
$this->state = $this->get('state');
$this->pagination = $pagination;
parent::display($tpl);
} else {
//no images in the folder, redirect to uploadscreen and raise notice
JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_JEM_NO_IMAGES_AVAILABLE'));
$this->setLayout('uploadimage');
$app->input->set('task', $task);
$this->_displayuploadimage($tpl);
return;
}
}
示例11: getGroupsField
public static function getGroupsField()
{
$db =& JFactory::getDbo();
$db->setQuery('
SELECT a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level
FROM #__usergroups AS a
LEFT JOIN `#__usergroups` AS b ON a.lft > b.lft AND a.rgt < b.rgt
GROUP BY a.id
ORDER BY a.lft ASC');
$options = $db->loadObjectList();
// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseNotice(500, $db->getErrorMsg());
return null;
}
for ($i = 0, $n = count($options); $i < $n; $i++) {
$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
}
$gids = array();
foreach ($options as $k => $v) {
$gids[] = get_object_vars($v);
}
$gids[0] = array('value' => 0, 'text' => Sobi::Txt('ACL.REG_VISITOR'), 'level' => 0);
return $gids;
}
示例12: setStatus
/**
* Logic to publish/unpublish/trash venues
*
* @access protected
* @return void
*
*/
protected function setStatus($status, $message)
{
// Check for request forgeries
JSession::checkToken() or jexit('Invalid Token');
$app = JFactory::getApplication();
$input = $app->input;
$cid = $input->get('cid', array(), 'array');
if (empty($cid)) {
JError::raiseNotice(100, JText::_('COM_JEM_SELECT_ITEM_TO_PUBLISH'));
$this->setRedirect(JEMHelperRoute::getMyVenuesRoute());
return;
}
$model = $this->getModel('myvenues');
if (!$model->publish($cid, $status)) {
echo "<script> alert('" . $model->getError() . "'); window.history.go(-1); </script>\n";
}
$total = count($cid);
$msg = $total . ' ' . JText::_($message);
$this->setRedirect(JEMHelperRoute::getMyVenuesRoute(), $msg);
}
示例13: upload
/**
* Upload a file
* @param string $source File to upload
* @param string $destination Upload to here
* @return True on success
*/
public static function upload($source, $destination)
{
$err = null;
$ret = false;
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
// Load configurations.
$config = CFactory::getConfig();
// Make the filename safe
jimport('joomla.filesystem.file');
if (!isset($source['name'])) {
JError::raiseNotice(100, JText::_('COM_COMMUNITY_INVALID_FILE_REQUEST'));
return $ret;
}
$source['name'] = JFile::makeSafe($source['name']);
if (is_dir($destination)) {
jimport('joomla.filesystem.folder');
JFolder::create($destination, (int) octdec($config->get('folderpermissionsvideo')));
JFile::copy(JPATH_ROOT . '/components/com_community/index.html', $destination . '/index.html');
$destination = JPath::clean($destination . '/' . strtolower($source['name']));
}
if (JFile::exists($destination)) {
JError::raiseNotice(100, JText::_('COM_COMMUNITY_FILE_EXISTS'));
return $ret;
}
if (!JFile::upload($source['tmp_name'], $destination)) {
JError::raiseWarning(100, JText::_('COM_COMMUNITY_UNABLE_TO_UPLOAD_FILE'));
return $ret;
} else {
$ret = true;
return $ret;
}
}
示例14: onBeforeAddProductToCart
public function onBeforeAddProductToCart($cart, &$product_id, &$quantity, &$attr_id, &$freeattributes, &$updateqty, &$errors, &$displayErrorMessage, &$additional_fields, &$usetriggers)
{
$cart->clear();
$date_from = $this->DateToUnix($freeattributes[1]);
$date_to = $this->DateToUnix($freeattributes[2]);
$db = JFactory::getDBO();
//проверяем не фейковая ли это квартира
$field = 'extra_field_' . $this->fake_extra_field_id;
$query = "SELECT `{$field}` FROM `#__jshopping_products` WHERE `product_id` = {$product_id}";
$db->setQuery($query);
$value = $db->loadResult();
//var_dump($value);die;
if ($value == $this->fake_yes_extra_field_value) {
$mainframe = JFactory::getApplication();
JError::raiseNotice(100, _JSHOP_OBJECT_IS_BOOKED);
$category_id = JRequest::getInt('category_id');
$mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=product&task=view&category_id=' . $category_id . '&product_id=' . $product_id, 1, 1));
return;
}
//проверяем доступность по датам
$query = "SELECT `product_id`, `dfrom`, `dto` FROM `#__jshopping_order_bookings` WHERE (`product_id` = {$product_id}) AND (`dfrom` > " . time() . ") ORDER BY `order_id` DESC";
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$order_date_from = $row->dfrom;
$order_date_to = $row->dto;
if ($date_from >= $order_date_from && $date_from <= $order_date_to || $date_to >= $order_date_from && $date_to <= $order_date_to) {
$mainframe = JFactory::getApplication();
JError::raiseNotice(100, _JSHOP_OBJECT_IS_BOOKED);
$category_id = JRequest::getInt('category_id');
$mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=product&task=view&category_id=' . $category_id . '&product_id=' . $product_id, 1, 1));
break;
}
}
}
示例15: getGroups
/**
* Method to get the filtering groups (null means no filtering)
*
* @return array|null array of filtering groups or null.
* @since 1.6
*/
protected function getGroups()
{
// Compute usergroups
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id');
$query->from('#__usergroups');
$db->setQuery($query);
$groups = $db->loadColumn();
// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseNotice(500, $db->getErrorMsg());
return null;
}
foreach ($groups as $i => $group) {
if (JAccess::checkGroup($group, 'core.admin')) {
continue;
}
if (!JAccess::checkGroup($group, 'core.manage', 'com_messages')) {
unset($groups[$i]);
continue;
}
if (!JAccess::checkGroup($group, 'core.login.admin')) {
unset($groups[$i]);
continue;
}
}
return array_values($groups);
}