Beispiel #1
1
 /**
  * Save the configuration
  *
  * @return void
  * @since 1.0
  */
 function save()
 {
     $jform = JRequest::getVar('jform', array(), 'post', 'array');
     $iid = $jform['series_id'];
     $aid = $jform['automailing_id'];
     $msg = false;
     if (isset($jform['time_start']) && empty($jform['time_start'])) {
         $err = true;
         $msg = JText::_("COM_NEWSLETTER_START_TIME_IS_EMPTY");
     }
     //		if (isset($jform['time_offset']) && empty($jform['time_offset'])) {
     //			$err = true;
     //			$msg = JText::_("COM_NEWSLETTER_TIME_OFFSET_IS_EMPTY");
     //		}
     if (empty($err) && parent::save()) {
         // Set the redirect based on the task.
         switch ($this->getTask()) {
             case 'save':
                 $this->setRedirect(JRoute::_('index.php?option=com_newsletter&view=close&tmpl=component', false));
                 break;
         }
         return true;
     }
     $this->setRedirect(JRoute::_('index.php?option=com_newsletter&tmpl=component&view=' . $this->view_item . $this->getRedirectToItemAppend($iid, 'series_id') . '&automailing_id=' . $aid, false), $msg);
     return false;
 }
Beispiel #2
1
 /**
  * constructor (registers additional tasks to methods)
  * @return void
  */
 function __construct()
 {
     parent::__construct();
     // Set reference to parameters
     $this->params = JComponentHelper::getParams('com_chessvn');
     //$dummy = $this->params->get('parm_text');
 }
Beispiel #3
0
 public function save($key = NULL, $urlVar = NULL)
 {
     if (!parent::save($key = NULL, $urlVar = NULL)) {
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', JText::_('COM_HTRAININGLOGS_PORTLET_EXISTS')));
         $this->setMessage($this->getError(), 'error');
     }
 }
 /**
  * Method to cancel an edit.
  *
  * @param     string     $key    The name of the primary key of the URL variable.
  *
  * @return    boolean            True if access level checks pass, false otherwise.
  */
 public function cancel($key = 'id')
 {
     $result = parent::cancel($key);
     // Redirect to the return page.
     $this->setRedirect($this->getReturnPage());
     return $result;
 }
 function DisplayView()
 {
     $submenu = JRequest::getVar('view');
     // Add submenu
     VideotranslationHelper::addSubmenu($submenu);
     parent::display();
 }
 /**
  * Proxy for getModel.
  */
 function display($cachable = false, $urlparams = array())
 {
     $task = $_POST['task'];
     if ($task == 'linksform.add' or $task == 'add' or $task == 'linksform.edit' or $task == 'edit') {
         $this->setRedirect('index.php?option=com_youtubegallery&view=settings&layout=edit');
         return true;
     }
     JRequest::setVar('view', 'settings');
     JRequest::setVar('layout', 'edit');
     switch (JRequest::getVar('task')) {
         case 'apply':
             $this->save();
             break;
         case 'settings.apply':
             $this->save();
             break;
         case 'save':
             $this->save();
             break;
         case 'settings.save':
             $this->save();
             break;
         case 'cancel':
             $this->cancel();
             break;
         case 'settings.cancel':
             $this->cancel();
             break;
         default:
             parent::display();
             break;
     }
 }
Beispiel #7
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->_app = JFactory::getApplication();
     $this->_input = $this->_app->input;
     $this->_config = JSNConfigHelper::get();
 }
Beispiel #8
0
 function __construct($config = array())
 {
     parent::__construct($config);
     // Need to set list view to plural format in legacy/controllers/form/constructor with array('/is$/i', "ises")
     // Or change like here
     $this->view_list = $this->view_item . "es";
 }
 /**
  * Edit document.
  */
 public function edit($key = null, $urlVar = null)
 {
     if (JFactory::getApplication()->isSite()) {
         JRequest::setVar('id', $this->getModel()->searchIdByPath(JoomDOCRequest::getPath()), 'post');
     }
     parent::edit();
 }
Beispiel #10
0
 public function save($key = null, $urlVar = null)
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $model = $this->getModel('form');
     $preconfig = $app->input->post->get('config', array(), 'array');
     $task = $this->getTask();
     $config = $model->store($preconfig);
     $id = $config['pk'];
     if ($config['validate'] == 'retry') {
         parent::display();
         return true;
     }
     if ($id) {
         if ($config['stage'] > -1) {
             $link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery();
             if ($config['stage'] > 0) {
                 $link .= '&stage=' . $config['stage'];
             }
             $this->setRedirect(htmlspecialchars_decode($link));
             return;
         }
         if ($config['message_style']) {
             if (isset($config['message'])) {
                 $msg = $config['doTranslation'] ? JText::_('COM_CCK_' . str_replace(' ', '_', trim($config['message']))) : $config['message'];
             } else {
                 $msg = JText::_('COM_CCK_SUCCESSFULLY_SAVED');
             }
             $msgType = $config['message_style'];
         } else {
             $msg = '';
             $msgType = '';
         }
     } else {
         $msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED');
         $msgType = 'error';
     }
     switch ($task) {
         case 'apply':
             $link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery();
             break;
         case 'save2new':
             $link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . $this->_getRedirectQuery();
             break;
         case 'save2view':
             $location = JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core WHERE id = ' . (int) $id);
             $sef = 0;
             $itemId2 = 0;
             if ($location) {
                 require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/' . $location . '.php';
                 $link = JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'getRoute', array($config['pk'], $sef, $itemId2, array('type' => $config['type'])));
                 $link = str_replace('/administrator/', '/', $link);
                 break;
             }
         default:
             $link = $this->_getRedirectQuery(true);
             break;
     }
     $this->setRedirect(htmlspecialchars_decode($link), $msg, $msgType);
 }
 /**
  * Method override to check if you can edit an existing record.
  *
  * @param     array      $data    An array of input data.
  * @param     string     $key     The name of the key for the primary key.
  *
  * @return    boolean
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     $uid = $user->get('id');
     $id = (int) isset($data[$key]) ? $data[$key] : 0;
     $owner = (int) isset($data['created_by']) ? $data['created_by'] : 0;
     // Check general edit permission first.
     if ($user->authorise('core.edit', 'com_pfrepo.directory.' . $id)) {
         return true;
     }
     // Fallback on edit.own.
     if ($user->authorise('core.edit.own', 'com_pfrepo.directory.' . $id)) {
         // Now test the owner is the user.
         if (!$owner && $id) {
             $record = $this->getModel()->getItem($id);
             if (empty($record)) {
                 return false;
             }
             $owner = $record->created_by;
         }
         if ($owner == $uid) {
             return true;
         }
     }
     // Fall back to the component permissions.
     return parent::allowEdit($data, $key);
 }
Beispiel #12
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     if (JDEBUG) {
         JLog::addLogger(array('text_file' => 'com_usernotes.log.php'), JLog::ALL, array('com_usernotes'));
     }
 }
Beispiel #13
0
 function __construct()
 {
     parent::__construct();
     $this->registerTask('themeinstall', 'themeinstall');
     $this->registerTask('bgimagesmall', 'bgimagesmall');
     $this->registerTask('bgimagemedium', 'bgimagemedium');
 }
Beispiel #14
0
 public function add()
 {
     JRequest::setVar('view', 'template');
     JRequest::setVar('layout', 'add');
     JRequest::setVar('hidemainmenu', 1);
     parent::display();
 }
Beispiel #15
0
 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $canDo = ZhYandexMapHelper::getMarkerActions($recordId);
     $canEdit = $canDo->get('core.edit');
     $isEnabledEditOwn = $canDo->get('core.edit.own');
     if ($canEdit || $canEditOwn) {
     }
     // Check general edit permission first.
     if ($canEdit) {
         return true;
     }
     // Fallback on edit.own.
     // First test if the permission is available.
     if ($isEnabledEditOwn) {
         // Now test the owner is the user.
         $ownerId = (int) isset($data['createdbyuser']) ? $data['createdbyuser'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->createdbyuser;
         }
         // If the owner matches 'me' then do the test.
         if ($ownerId == $userId) {
             return true;
         }
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
Beispiel #16
0
 /**
  * Method to get a model object, loading it if required.
  *
  * @param   string  $name    The model name. Optional.
  * @param   string  $prefix  The class prefix. Optional.
  * @param   array   $config  Configuration array for model. Optional.
  *
  * @return  object  The model.
  *
  * @since   11.1
  */
 public function getModel($name = '', $prefix = '', $config = array('ignore_request' => true))
 {
     if (empty($name)) {
         $name = $this->context;
     }
     return parent::getModel($name, $prefix, array('ignore_request' => false));
 }
 /**
  * Execute.
  *
  * @param   string  $task  An optional associative array of configuration settings.
  *
  * @return void
  *
  * @since    1.7.0
  */
 public function execute($task)
 {
     if ($task != 'run') {
         $task = 'browse';
     }
     parent::execute($task);
 }
 /**
  * Construct the controller 
  * 
  * @copyright 
  * @author		RolandD 
  * @todo 
  * @see 
  * @access 		public
  * @param 
  * @return 
  * @since 		3.0
  */
 public function __construct()
 {
     parent::__construct();
     // Register some task
     $this->registerTask('sortcategories', 'options');
     $this->registerTask('icecatsettings', 'options');
 }
 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since    1.7.0
  */
 protected function allowEdit($data = [], $key = 'id')
 {
     // Initialise variables.
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     // Check general edit permission first.
     if ($user->authorise('core.edit')) {
         return true;
     }
     // Fallback on edit.own.
     // First test if the permission is available.
     if ($user->authorise('core.edit.own')) {
         // Now test the owner is the user.
         $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->created_by;
         }
         // If the owner matches 'me' then do the test.
         if ($ownerId == $userId) {
             return true;
         }
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
 public function edit($key = null, $urlVar = null)
 {
     JRequest::setVar('view', 'feed');
     JRequest::setVar('layout', 'feed');
     JRequest::setVar('hidemainmenu', 1);
     parent::display();
 }
 public function getModel($name = '', $prefix = '', $config = array('ignore_request' => true))
 {
     if (!isset($this->model)) {
         $this->model = parent::getModel($name, $prefix, array('ignore_request' => false));
     }
     return $this->model;
 }
Beispiel #22
0
 public function execute($task = null)
 {
     $app = JFactory::getApplication();
     $modelName = $app->input->get('model', 'Calendar');
     // Required objects
     $input = JFactory::getApplication()->input;
     // Get the form data
     $this->formData = new JRegistry($input->get('jform', '', 'array'));
     //Get model class
     $this->model = $this->getModel($modelName);
     if ($task == 'deleteListDaytime') {
         $this->deleteListDaytime();
     } elseif ($task == 'cancel') {
         $this->cancel();
     } else {
         if ($task == 'apply') {
             parent::save();
             $app->enqueueMessage('Calendrier sauvé avec succès!');
             $app->redirect($_SERVER['HTTP_REFERER']);
         } else {
             if ($task == 'save') {
                 parent::save();
             } else {
                 $this->edit();
             }
         }
     }
 }
Beispiel #23
0
 /**
  * Method to cancel an edit.
  *
  * @param   string  $key  The name of the primary key of the URL variable.
  *
  * @return  Boolean  True if access level checks pass, false otherwise.
  *
  * @since   1.6
  */
 public function cancel($key = null)
 {
     $return = parent::cancel($key);
     // Redirect to the main page.
     $this->setRedirect(JRoute::_('index.php', false));
     return $return;
 }
Beispiel #24
0
 function edit()
 {
     JRequest::setVar('view', 'feed');
     JRequest::setVar('layout', 'feed');
     JRequest::setVar('hidemainmenu', 1);
     parent::display();
 }
 public function display($cachable = false, $urlparams = false)
 {
     /*		// Initialise variables.
     		$cachable	= true;	// Huh? Why not just put that in the constructor?
     		$user		= JFactory::getUser();
     
     		// Set the default view name and format from the Request.
     		// Note we are using w_id to avoid collisions with the router and the return page.
     		// Frontend is a bit messier than the backend.
     		$id		= $this->input->getInt('w_id');
     		$vName	= $this->input->getCmd('view', 'categories');
     		$this->input->set('view', $vName);
     
     		if ($user->get('id') ||($_SERVER['REQUEST_METHOD'] == 'POST' && $vName = 'categories')) {
     			$cachable = false;
     		}
     
     		$safeurlparams = array(
     			'id'				=> 'INT',
     			'limit'				=> 'INT',
     			'limitstart'		=> 'INT',
     			'filter_order'		=> 'CMD',
     			'filter_order_Dir'	=> 'CMD',
     			'lang'				=> 'CMD'
     		);
     
     		// Check for edit form.
     		if ($vName == 'form' && !$this->checkEditId('com_usernotify.edit.usersubs', $id)) {
     			// Somehow the person just went to the form - we don't allow that.
     			return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
     		}
     */
     return parent::display($cachable, $urlparams);
 }
Beispiel #26
0
 /**
  * Save a template field
  *
  * @copyright
  * @author 		RolanD
  * @todo
  * @see
  * @access 		public
  * @param
  * @return
  * @since 		4.3
  */
 public function save($key = null, $urlVar = null)
 {
     if (parent::save($key, $urlVar)) {
         $this->setRedirect('');
         JFactory::getDocument()->addScriptDeclaration('window.parent.location.href = window.parent.location.href;');
         JFactory::getDocument()->addScriptDeclaration('window.parent.SqueezeBox.close();');
     }
 }
Beispiel #27
0
 function __construct($config = array())
 {
     parent::__construct($config);
     // Register Extra tasks
     $this->registerTask('unpublish', 'publish');
     $this->registerTask('trash', 'remove');
     $this->registerTask('delete', 'remove');
 }
Beispiel #28
0
 public function save($key = null, $urlVar = null)
 {
     $data = $this->input->post->get('jform', array(), 'array');
     $model = $this->getModel();
     $table = $model->getTable();
     $url = $table->getKeyName();
     parent::save($key = $data['id'], $urlVar = $url);
 }
Beispiel #29
0
 public function batch()
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $model = $this->getModel('category', '', array());
     // Preset the redirect
     $this->setRedirect(JRoute::_('index.php?option=com_jdownloads&view=categories' . $this->getRedirectToListAppend(), false));
     return parent::batch($model);
 }
Beispiel #30
0
 public function cancel($key = null)
 {
     parent::cancel($key);
     $model = $this->getModel();
     if ($model->getTempId()) {
         $this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=transactions', false));
     }
 }