本文整理汇总了PHP中JError::raiseError方法的典型用法代码示例。如果您正苦于以下问题:PHP JError::raiseError方法的具体用法?PHP JError::raiseError怎么用?PHP JError::raiseError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JError
的用法示例。
在下文中一共展示了JError::raiseError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Generates a list of JSON items.
*
* @return void
*/
public function display($tpl = null)
{
$model = $this->getModel();
$this->item = $this->get('Item');
$this->component = $model->getState($model->getName() . '.component');
$this->section = $model->getState($model->getName() . '.section');
$this->asset_id = $model->getState($model->getName() . '.asset_id');
$this->project_id = $model->getState($model->getName() . '.project_id');
$this->inherit = $model->getState($model->getName() . '.inherit');
if (!$this->asset_id && $this->inherit) {
$this->asset_id = $this->getComponentProjectAssetId($this->component, $this->project_id);
}
$this->rules = $this->getAssetRules();
$this->public_groups = array('1', JComponentHelper::getParams('com_users')->get('guest_usergroup', 1));
$user = JFactory::getUser();
if (!$user->authorise('core.admin', $this->component) && !$user->authorise('core.manage', $this->component)) {
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
parent::display($tpl);
}
示例2: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a Error object.
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Preprocess the list of items to find ordering divisions.
foreach ($this->items as &$item) {
$this->ordering[$item->parent_id][] = $item->id;
}
// Levels filter.
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('J1'));
$options[] = JHtml::_('select.option', '2', JText::_('J2'));
$options[] = JHtml::_('select.option', '3', JText::_('J3'));
$options[] = JHtml::_('select.option', '4', JText::_('J4'));
$options[] = JHtml::_('select.option', '5', JText::_('J5'));
$options[] = JHtml::_('select.option', '6', JText::_('J6'));
$options[] = JHtml::_('select.option', '7', JText::_('J7'));
$options[] = JHtml::_('select.option', '8', JText::_('J8'));
$options[] = JHtml::_('select.option', '9', JText::_('J9'));
$options[] = JHtml::_('select.option', '10', JText::_('J10'));
$this->f_levels = $options;
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal') {
$this->addToolbar();
}
parent::display($tpl);
}
示例3: move
/**
* swap the ordering of a record in the Xref tables
* @param $direction , 1/-1 The increment to reorder by
*/
function move($direction, $where = '', $orderingkey = 0)
{
if (empty($this->_skey)) {
vmError('No secondary keys defined in VmTableXarray ' . $this->_tbl);
return false;
}
$skeyId = vRequest::getInt($this->_skey, 0);
// Initialize variables
$db = JFactory::getDBO();
$cid = vRequest::getInt($this->_pkey);
$order = vRequest::getInt('order');
//I found now two times "order" instead of ordering.
//This sql is broken
$query = 'SELECT `id` FROM `' . $this->_tbl . '` WHERE ' . $this->_pkey . ' = ' . (int) $cid[0] . ' AND `tsmart_category_id` = ' . (int) $skeyId;
$db->setQuery($query);
$id = $db->loadResult();
$keys = array_keys($order);
// TODO next 2 lines not used ????
if ($direction > 0) {
$idToSwap = $order[$keys[array_search($id, $keys)] + 1];
} else {
$idToSwap = $order[$keys[array_search($id, $keys)] - 1];
}
if (isset($cid[0])) {
$query = 'UPDATE `' . $this->_tbl . '` ' . ' SET `' . $this->_orderingKey . '` = `' . $this->_orderingKey . '` + ' . $direction . ' WHERE `' . $this->_pkey . '` = ' . (int) $cid[0] . ' AND `' . $this->_skey . '` = ' . (int) $skeyId;
$db->setQuery($query);
if (!$db->execute()) {
$err = $db->getErrorMsg();
JError::raiseError(500, get_class($this) . ':: move ' . $err);
}
}
}
示例4: display
function display($tpl = null)
{
global $mainframe;
// Check if registration is allowed
$usersConfig =& JComponentHelper::getParams('com_users');
if (!$usersConfig->get('allowUserRegistration')) {
JError::raiseError(403, JText::_('Access Forbidden'));
return;
}
$pathway =& $mainframe->getPathway();
$document =& JFactory::getDocument();
$params =& $mainframe->getParams();
// Page Title
$menus =& JSite::getMenu();
$menu = $menus->getActive();
// because the application sets a default page title, we need to get it
// right from the menu item itself
if (is_object($menu)) {
$menu_params = new JParameter($menu->params);
if (!$menu_params->get('page_title')) {
$params->set('page_title', JText::_('Registration'));
}
} else {
$params->set('page_title', JText::_('Registration'));
}
$document->setTitle($params->get('page_title'));
$pathway->addItem(JText::_('New'));
// Load the form validation behavior
JHTML::_('behavior.formvalidation');
$user =& JFactory::getUser();
$this->assignRef('user', $user);
$this->assignRef('params', $params);
parent::display($tpl);
}
示例5: display
/**
* Display the view
*/
public function display($tpl = null)
{
JFactory::getLanguage()->load('com_categories');
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Preprocess the list of items to find ordering divisions.
foreach ($this->items as &$item) {
$this->ordering[$item->parent_id][] = $item->id;
}
// Levels filter.
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('J1'));
$options[] = JHtml::_('select.option', '2', JText::_('J2'));
$options[] = JHtml::_('select.option', '3', JText::_('J3'));
$options[] = JHtml::_('select.option', '4', JText::_('J4'));
$options[] = JHtml::_('select.option', '5', JText::_('J5'));
$options[] = JHtml::_('select.option', '6', JText::_('J6'));
$options[] = JHtml::_('select.option', '7', JText::_('J7'));
$options[] = JHtml::_('select.option', '8', JText::_('J8'));
$options[] = JHtml::_('select.option', '9', JText::_('J9'));
$options[] = JHtml::_('select.option', '10', JText::_('J10'));
$this->assign('f_levels', $options);
$this->assign('listsGroup', $this->get('Groups'));
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
示例6: display
function display($tpl = null)
{
$this->categories = $this->get('Categories');
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->countItems = $this->get('CountItems');
$this->pagination = $this->get('Pagination');
/*
jimport('joomla.html.pagination');
$limit = JRequest::getVar('limit', '25', '', 'int');
$limitstart = JRequest::getVar('limitstart', '0', '', 'int');
$pagination = new JPagination($this->countItems, $limitstart, $limit);
$this->pagination = $pagination;*/
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
$version = new JVersion();
if (version_compare($version->getShortVersion(), '3.0.0', '<')) {
$tpl = 'legacy';
} else {
/*JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_CATEGORY'),
'filter_category',
JHtml::_('select.options', DJClassifiedsCategory::getCatSelect(), 'value', 'text', $this->state->get('filter.category'), true)
);*/
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', array(JHtml::_('select.option', '1', 'JPUBLISHED'), JHtml::_('select.option', '0', 'JUNPUBLISHED')), 'value', 'text', $this->state->get('filter.published'), true));
JHtmlSidebar::addFilter(JText::_('COM_DJCLASSIFIEDS_SELECT_ACTIVE'), 'filter_active', JHtml::_('select.options', array(JHtml::_('select.option', '1', 'COM_DJCLASSIFIEDS_ACTIVE'), JHtml::_('select.option', '0', 'COM_DJCLASSIFIEDS_HIDE')), 'value', 'text', $this->state->get('filter.active'), true));
$this->sidebar = JHtmlSidebar::render();
}
parent::display($tpl);
}
示例7: save
public function save() {
$app = JFactory::getApplication ();
if (! JRequest::checkToken ()) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
$this->redirectBack ();
}
// perform security checks
$this->user = JFactory::getUser();
if ($this->user->id == 0) {
JError::raiseError( 403, JText::_('Access Forbidden') );
return;
}
$this->config = KunenaFactory::getConfig();
$this->saveUser();
$this->me = KunenaFactory::getUser();
$this->saveProfile();
$this->saveAvatar();
$this->saveSettings();
if (!$this->me->save()) {
$app = JFactory::getApplication();
$app->enqueueMessage($this->me->getError(), 'notice');
}
$msg = JText::_( 'COM_KUNENA_PROFILE_SAVED' );
$this->setRedirect ( CKunenaLink::GetMyProfileURL($this->user->get('id'), '', false), $msg );
}
示例8: display
/**
* Method to display the view.
*
* @param string The template file to include
* @since 1.5
*/
public function display($tpl = null)
{
// This name will be used to get the model
$name = $this->getLayout();
// Check that the name is valid - has an associated model.
if (!in_array($name, array('confirm', 'complete'))) {
$name = 'default';
}
if ('default' == $name) {
$formname = 'Form';
} else {
$formname = ucfirst($this->_name) . ucfirst($name) . 'Form';
}
// Get the view data.
$this->form = $this->get($formname);
$this->state = $this->get('State');
$this->params = $this->state->params;
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
$this->prepareDocument();
parent::display($tpl);
}
示例9: display
function display($tpl = null)
{
$this->form = $this->get('Form');
// Get data from the model
$this->item = $this->get('Item');
$this->taxrules = $this->get('TaxRules');
// inturn calls getState in parent class and populateState() in model
$this->state = $this->get('State');
$this->model = $this->getModel('taxprofile');
$lists['taxrate'] = $this->get('TaxRateList');
$lists['address'] = $this->get('AddressList');
$this->lists = $lists;
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
//add toolbar
$this->addToolBar();
$toolbar = new K2StoreToolBar();
$toolbar->renderLinkbar();
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
示例10: save
public function save()
{
// Check for request forgeries
JRequest::checkToken() or die('RESTRICTED');
$row = WFExtensionHelper::getPlugin(null, 'jcemediabox', 'system');
$task = $this->getTask();
// remove id for Joomla! 2.5+
if ($row->extension_id) {
unset($row->id);
}
if (!$row->bind(JRequest::get('post'))) {
JError::raiseError(500, $row->getError());
}
if (!$row->check()) {
JError::raiseError(500, $row->getError());
}
if (!$row->store()) {
JError::raiseError(500, $row->getError());
}
$row->checkin();
$msg = JText::sprintf('WF_MEDIABOX_SAVED');
switch ($task) {
case 'apply':
$this->setRedirect('index.php?option=com_jce&view=mediabox', $msg);
break;
case 'save':
default:
$this->setRedirect('index.php?option=com_jce&view=cpanel', $msg);
break;
}
}
示例11: display
/**
* display method of playjoom view
* @return void
*/
public function display($tpl = null)
{
//Get User Objects
$user = JFactory::getUser();
$canDo = PlayJoomHelper::getActions();
// get the Data
$form = $this->get('Form');
$item = $this->get('Item');
$script = $this->get('Script');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Assign the Data
$this->form = $form;
$this->item = $item;
$this->script = $script;
if ($canDo->get('core.edit') || $canDo->get('core.create') && !JRequest::getVar('id') || JAccess::check($user->get('id'), 'core.admin') == 1) {
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
} else {
JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
// Set the document
$this->setDocument();
}
示例12: display
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->categories = Djc2Categories::getInstance();
$user = JFactory::getUser();
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->ordering = array();
foreach ($this->items as &$item) {
if (!isset($this->ordering[$item->parent_id])) {
$this->ordering[$item->parent_id] = array();
}
$this->ordering[$item->parent_id][] = $item->id;
}
$this->addToolbar();
if (class_exists('JHtmlSidebar') && $user->authorise('core.admin')) {
$this->sidebar = JHtmlSidebar::render();
}
$version = new JVersion();
if (version_compare($version->getShortVersion(), '3.0.0', '<')) {
$tpl = 'legacy';
}
parent::display($tpl);
}
示例13: display
public function display($tpl = null)
{
$user = JFactory::getUser();
// Get model data.
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->return_page = $this->get('ReturnPage');
if (empty($this->item->id)) {
$authorised = $user->authorise('core.create', 'com_weblinks') || count($user->getAuthorisedCategories('com_weblinks', 'core.create'));
} else {
$authorised = $user->authorise('core.edit', 'com_weblinks.category.' . $this->item->catid);
}
if ($authorised !== true) {
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
if (!empty($this->item)) {
$this->form->bind($this->item);
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// Create a shortcut to the parameters.
$params =& $this->state->params;
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$this->params = $params;
$this->user = $user;
$this->_prepareDocument();
parent::display($tpl);
}
示例14: display
/**
* Display the view
*
* @return void
*/
public function display($tpl = null)
{
if ($this->getLayout() !== 'modal') {
ContentHelper::addSubmenu('articles');
}
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->authors = $this->get('Authors');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Levels filter.
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('J1'));
$options[] = JHtml::_('select.option', '2', JText::_('J2'));
$options[] = JHtml::_('select.option', '3', JText::_('J3'));
$options[] = JHtml::_('select.option', '4', JText::_('J4'));
$options[] = JHtml::_('select.option', '5', JText::_('J5'));
$options[] = JHtml::_('select.option', '6', JText::_('J6'));
$options[] = JHtml::_('select.option', '7', JText::_('J7'));
$options[] = JHtml::_('select.option', '8', JText::_('J8'));
$options[] = JHtml::_('select.option', '9', JText::_('J9'));
$options[] = JHtml::_('select.option', '10', JText::_('J10'));
$this->f_levels = $options;
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal') {
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
}
parent::display($tpl);
}
示例15: display
/**
* Display the view
*/
public function display($tpl = null)
{
$params = JComponentHelper::getParams('com_tz_pinboard');
$img_size = $params->get('portfolio_image_size');
$this->assign('img_size', $img_size);
if (JRequest::getCmd('task') != 'lists') {
JFactory::getLanguage()->load('com_content');
if ($this->getLayout() == 'pagebreak') {
// TODO: This is really dogy - should change this one day.
$eName = JRequest::getVar('e_name');
$eName = preg_replace('#[^A-Z0-9\\-\\_\\[\\]]#i', '', $eName);
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_CONTENT_PAGEBREAK_DOC_TITLE'));
$this->assignRef('eName', $eName);
parent::display($tpl);
return;
}
// Initialiase variables.
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->canDo = TZ_PinboardHelper::getActions($this->state->get('filter.category_id'));
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->assign('listsGroup', $this->get('FieldsGroup'));
$this->assign('listsTags', $this->get('Tags'));
$this->assign('listAttach', $this->get('Attachment'));
$this->assign('listEdit', $this->get('FieldsContent'));
$this->addToolbar();
}
parent::display($tpl);
}