/** * Prepares the delete page */ public function get_delete(array $args) { $this->data['can_not_delete'] = true; $this->load_object($args); $redirect = com_meego_devprogram_utils::get_url('my_membership_delete', array('membership_guid' => $this->object->guid)); $user = com_meego_devprogram_utils::require_login($redirect); $this->data['person'] = $user->person; if (com_meego_devprogram_utils::is_current_user_creator_or_admin($this->object)) { parent::get_delete($args); $this->data['index_url'] = com_meego_devprogram_utils::get_url('index', array()); $this->data['can_not_delete'] = false; $this->data['delete_question'] = $this->mvc->i18n->get('question_membership_delete', null, array('provider_name' => $this->data['provider']->title)); } else { // nice try... $this->mvc->head->relocate(com_meego_devprogram_utils::get_url('index', array())); } }
/** * Prepares the create form */ public function get_create(array $args) { // require login $redirect = com_meego_devprogram_utils::get_url('provider_create', $args); $user = com_meego_devprogram_utils::require_login($redirect); parent::get_create($args); }
/** * Prepares the application page * * @param array args */ public function get_create(array $args) { if (!strlen($args['program_name'])) { $url = com_meego_devprogram_utils::get_url('index', $args); $this->mvc->head->relocate($url); } // require login $redirect = com_meego_devprogram_utils::get_url('my_application_create', $args); $user = com_meego_devprogram_utils::require_login($redirect); // @todo: sanity check $programs = com_meego_devprogram_progutils::get_programs(array('name' => $args['program_name'])); $program = $programs[0]; if (!is_object($program)) { throw new InvalidArgumentException("Program: {$args['program_name']} con not be found"); } $this->data['program'] = $program; // check if the user has applied for the program and // display a warning if yes // in case of multiple applications we only refer to the 1st $this->data['myapps'] = com_meego_devprogram_apputils::get_applications_of_current_user($program->id); $now = new DateTime(); if ($program->duedate >= $now && (!count($this->data['myapps']) || $program->multiple)) { // we move on if user has not applied or // the program accepts multiple entries from the same person parent::get_create($args); } // load the text limiter js files $this->mvc->head->add_jsfile(MIDGARDMVC_STATIC_URL . '/' . $this->component . '/js/textLimit.js'); $this->mvc->head->add_jsfile(MIDGARDMVC_STATIC_URL . '/' . $this->component . '/js/limiter_for_applications.js'); }