Example #1
0
 function reject()
 {
     $app_id = JRequest::getVar('app_id', array(), 'post', 'int');
     $course_id = JRequest::getVar('course_id', array(), 'post', 'int');
     $cid = array($app_id);
     JoomdleHelperApplications::reject_applications($cid);
     $this->setRedirect('index.php?option=com_joomdle&view=applications&course_id=' . $course_id);
 }
Example #2
0
 protected function addToolbar()
 {
     JToolbarHelper::title(JText::_('COM_JOOMDLE_VIEW_COURSE_APPLICATIONS_TITLE'), 'mapping');
     JToolBarHelper::back('Back', 'index.php?option=com_joomdle&view=courseapplications');
     JToolBarHelper::custom('applications.approve', 'publish', 'publish', 'Approve applications', true, false);
     JToolBarHelper::custom('applications.reject', 'unpublish', 'unpublish', 'Reject applications', true, false);
     JHtmlSidebar::setAction('index.php?option=com_joomdle&view=courseapplications');
     JHtmlSidebar::addFilter(JText::_('COM_JOOMDLE_STATE'), 'filter_state', JHtml::_('select.options', JoomdleHelperApplications::getStateOptions(), 'value', 'text', $this->state->get('filter.state')));
 }
Example #3
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $this->assignRef('params', $params);
     $user = JFactory::getUser();
     $this->cursos = JoomdleHelperApplications::get_user_applications($user->id);
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->_prepareDocument();
     parent::display($tpl);
 }
Example #4
0
 function reject()
 {
     JRequest::checkToken() or jexit('Invalid Token');
     $course_id = JRequest::getVar('course_id', array(), 'post', 'int');
     $cid = JRequest::getVar('cid', array(), 'post', 'array');
     JArrayHelper::toInteger($cid);
     if (count($cid) < 1) {
         JError::raiseError(500, JText::_('Select an item to reject'));
     }
     JoomdleHelperApplications::reject_applications($cid);
     $this->setRedirect('index.php?option=com_joomdle&view=applications&course_id=' . $course_id);
 }
Example #5
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     $mainframe = JFactory::getApplication();
     $id = JRequest::getVar('course_id');
     $comp_params = JComponentHelper::getParams('com_joomdle');
     $app_id = JRequest::getVar('app_id');
     $this->app_info = JoomdleHelperApplications::get_application_info($app_id);
     $app_user = JFactory::getUser($this->app_info['user_id']);
     $this->app_info['name'] = $app_user->name;
     $course_info = JoomdleHelperContent::getCourseInfo((int) $this->app_info['course_id']);
     $this->app_info['course'] = $course_info['fullname'];
     $this->addToolbar();
     parent::display($tpl);
 }
Example #6
0
 static function reject_applications($cid)
 {
     $db = JFactory::getDBO();
     foreach ($cid as $id) {
         /* get application info */
         $query = "SELECT *\n\t\t\t\t\t\tFROM #__joomdle_course_applications  where id = " . $db->Quote($id);
         $db->setQuery($query);
         $app = $db->loadAssoc();
         $user_id = $app['user_id'];
         $user = JFactory::getUser($user_id);
         $username = $user->username;
         $course_id = $app['course_id'];
         $date = JFactory::getDate();
         $confirmation_date = $date->toSql();
         /* Mark as rejected */
         $query = "update  #__joomdle_course_applications set state=" . JOOMDLE_APPLICATION_STATE_REJECTED . ", confirmation_date = '{$confirmation_date}'  where id = " . $db->Quote($id);
         $db->setQuery($query);
         $db->query();
         /* Send message to user */
         JoomdleHelperApplications::send_confirmation_email($username, $user->email, $course_id, JOOMDLE_APPLICATION_STATE_REJECTED);
     }
 }
Example #7
0
 function applicate()
 {
     $mainframe = JFactory::getApplication();
     $params = $mainframe->getParams();
     $show_motivation = $params->get('show_detail_application_motivation', 'no');
     $show_experience = $params->get('show_detail_application_experience', 'no');
     $user = JFactory::getUser();
     $course_id = JRequest::getVar('course_id');
     $course_id = (int) $course_id;
     $login_url = JoomdleHelperMappings::get_login_url($course_id);
     if (!$user->id) {
         $mainframe->redirect($login_url);
     }
     //	$mainframe->redirect(JURI::base ().'index.php?option=com_user&view=login');
     $motivation = JRequest::getVar('motivation');
     $experience = JRequest::getVar('experience');
     $message = '';
     if ($show_motivation == 'mandatory' && !$motivation) {
         $url = JRoute::_("index.php?option=com_joomdle&view=detail&course_id={$course_id}");
         $message = JText::_('COM_JOOMDLE_MOTIVATION_MISSING');
         $this->setRedirect($url, $message);
         return;
     }
     if ($show_experience == 'mandatory' && !$experience) {
         $url = JRoute::_("index.php?option=com_joomdle&view=detail&course_id={$course_id}");
         $message = JText::_('COM_JOOMDLE_EXPERIENCE_MISSING');
         $this->setRedirect($url, $message);
         return;
     }
     $user = JFactory::getUser();
     $username = $user->get('username');
     $message = JText::_('COM_JOOMDLE_MAX_APPLICATIONS_REACHED');
     if (!JoomdleHelperApplications::user_can_applicate($user->id, $course_id, $message)) {
         $url = JRoute::_("index.php?option=com_joomdle&view=detail&course_id={$course_id}");
         $this->setRedirect($url, $message);
         return;
     }
     if (JoomdleHelperApplications::applicate_for_course($username, $course_id, $motivation, $experience)) {
         // Redirect to course detail page by default
         $url = JRoute::_("index.php?option=com_joomdle&view=detail&course_id={$course_id}");
         $message = JText::_('COM_JOOMDLE_APPLICATION_FOR_COURSE_DONE');
         // Get custom redirect url and message
         $additional_message = '';
         $new_url = '';
         $app = JFactory::getApplication();
         $results = $app->triggerEvent('onCourseApplicationDone', array($course_id, $user->id, &$additional_message, &$new_url));
         if ($additional_message) {
             $message .= '<br>' . $additional_message;
         }
         if ($new_url) {
             $url = $new_url;
         }
     } else {
         $url = JRoute::_("index.php?option=com_joomdle&view=detail&course_id={$course_id}");
         $message = JText::_('COM_JOOMDLE_APPLICATION_FOR_COURSE_ALREADY_DONE');
     }
     //$mainframe->redirect ($url);
     $this->setRedirect($url, $message);
 }