Ejemplo n.º 1
0
 function isAttentionRequired()
 {
     $user = $this->getUser();
     //get all student entered data;
     $att_reqs[] = CriticalEnquiry::get($user);
     $att_reqs[] = ExternalAwardReceipts::get($user);
     $att_reqs[] = Contributions::get($user);
     $att_reqs[] = CommunityBasedProject::get($user);
     $att_reqs[] = ResearchCitations::get($user);
     foreach ($att_reqs as $att_req) {
         if ($att_req && $att_req->isAttentionRequired()) {
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 2
0
 public function process()
 {
     $user = $this->_user;
     $translator = $this->_translator;
     $type = $this->type;
     static $valid = array("external_awards" => array("add", "remove", "edit"), "contributions" => array("add", "remove", "edit"), "critical_enquiry" => array("add", "remove", "edit"), "community_based_project" => array("add", "remove", "edit"), "research_citations" => array("add", "remove", "edit", "resequence"), "observerships" => array("add", "remove", "edit", "resequence"));
     $section = filter_input(INPUT_GET, 'mspr-section', FILTER_CALLBACK, array('options' => 'strtolower'));
     if ($section) {
         $params = array('entity_id' => FILTER_VALIDATE_INT, 'action' => array('filter' => FILTER_CALLBACK, 'options' => 'strtolower'), 'user_id' => FILTER_VALIDATE_INT);
         $inputs = filter_input_array(INPUT_POST, $params);
         extract($inputs);
         if (!$action) {
             add_error($translator->translate("mspr_no_action"));
         }
         if (!array_key_exists($section, $valid)) {
             add_error($translator->translate("mspr_invalid_section"));
         } else {
             if (!in_array($action, $valid[$section])) {
                 add_error($translator->translate("mspr_invalid_action"));
             }
         }
         if (!has_error() && in_array($action, array("add", "edit", "resequence"))) {
             $inputs = get_mspr_inputs($section);
             process_mspr_inputs($section, $inputs, $translator);
             //modifies inputs/adds errors
         }
         if (!has_error()) {
             $inputs['user_id'] = $user_id;
             if ($action == "add") {
                 switch ($section) {
                     case 'external_awards':
                         ExternalAwardReceipt::create($inputs);
                         break;
                     case 'contributions':
                         Contribution::create($inputs);
                         break;
                     case 'critical_enquiry':
                         if (CriticalEnquiry::get($user_id)) {
                             add_error($translator->translate("mspr_too_many_critical_enquiry"));
                         } else {
                             CriticalEnquiry::create($inputs);
                         }
                         break;
                     case 'community_based_project':
                         if (CommunityBasedProject::get($user_id)) {
                             add_error($translator->translate("mspr_too_many_community_based_project"));
                         } else {
                             CommunityBasedProject::create($inputs);
                         }
                         break;
                     case 'research_citations':
                         ResearchCitation::create($inputs);
                         break;
                     case 'observerships':
                         $observership = Observership::create($inputs);
                         break;
                 }
             } elseif ($action == "resequence") {
                 switch ($section) {
                     case 'research_citations':
                         ResearchCitations::setSequence($user_id, $inputs['research_citations']);
                         break;
                 }
             } else {
                 //everything else requires an entity
                 if ($entity_id) {
                     $entity = get_mspr_entity($section, $entity_id);
                     if ($entity) {
                         switch ($action) {
                             case "remove":
                                 $entity->delete();
                                 break;
                             case "edit":
                                 if ($entity instanceof Approvable) {
                                     $inputs['comment'] = "";
                                     $inputs['status'] = 0;
                                     //set to unapproved.
                                 }
                                 $entity->update($inputs);
                                 //inputs processed above
                                 break;
                         }
                     } else {
                         add_error($translator->translate("mspr_invalid_entity"));
                     }
                 } else {
                     add_error($translator->translate("mspr_no_entity"));
                 }
             }
         }
         switch ($section) {
             case 'external_awards':
                 $external_awards = ExternalAwardReceipts::get($user);
                 display_status_messages();
                 echo display_external_awards($external_awards, $type);
                 break;
             case 'contributions':
                 $contributions = Contributions::get($user);
                 display_status_messages();
                 echo display_contributions($contributions, $type);
                 break;
             case 'critical_enquiry':
                 $critical_enquiry = CriticalEnquiry::get($user);
                 display_status_messages();
                 echo display_critical_enquiry($critical_enquiry, $type);
                 break;
             case 'community_based_project':
                 $community_based_project = CommunityBasedProject::get($user);
                 display_status_messages();
                 echo display_community_based_project($community_based_project, $type);
                 break;
             case 'research_citations':
                 $research_citations = ResearchCitations::get($user);
                 display_status_messages();
                 echo display_research_citations($research_citations, $type);
                 break;
             case 'observerships':
                 $observerships = Observerships::get($user);
                 display_status_messages();
                 echo display_observerships($observerships, "public");
                 break;
         }
     }
 }
Ejemplo n.º 3
0
 public function process()
 {
     global $ENTRADA_USER;
     $user = $this->_user;
     $translator = $this->_translator;
     $type = $this->type;
     static $valid = array("studentships" => array("add", "remove", "edit"), "clineval" => array("add", "remove", "edit"), "internal_awards" => array("add", "remove", "edit"), "student_run_electives" => array("add", "remove", "edit"), "observerships" => array("add", "remove", "edit"), "int_acts" => array("add", "remove", "edit"), "external_awards" => array("approve", "unapprove", "reject", "add", "edit"), "contributions" => array("approve", "unapprove", "reject", "add", "edit"), "critical_enquiry" => array("approve", "unapprove", "reject", "add", "edit"), "community_based_project" => array("approve", "unapprove", "reject", "add", "edit"), "research_citations" => array("approve", "unapprove", "reject", "add", "edit", "resequence"));
     $section = filter_input(INPUT_GET, 'mspr-section', FILTER_CALLBACK, array('options' => 'strtolower'));
     if ($section) {
         $params = array('entity_id' => FILTER_VALIDATE_INT, 'action' => array('filter' => FILTER_CALLBACK, 'options' => 'strtolower'), 'comment' => FILTER_SANITIZE_STRING, 'user_id' => FILTER_VALIDATE_INT);
         $inputs = filter_input_array(INPUT_POST, $params);
         extract($inputs);
         if (!$action) {
             add_error($translator->translate("mspr_no_action"));
         }
         if (!array_key_exists($section, $valid)) {
             add_error($translator->translate("mspr_invalid_section"));
         } else {
             if (!in_array($action, $valid[$section])) {
                 add_error($translator->translate("mspr_invalid_action"));
             }
         }
         if ($action == "reject" && MSPR_REJECTION_REASON_REQUIRED) {
             if (!$comment) {
                 add_error($translator->translate("mspr_no_reject_reason"));
             }
         }
         if (!has_error() && in_array($action, array("add", "edit", "resequence"))) {
             $inputs = get_mspr_inputs($section);
             process_mspr_inputs($section, $inputs, $translator);
             //modifies inputs/adds errors
         }
         if (!has_error()) {
             $inputs['user_id'] = $user_id;
             if ($action == "add") {
                 if (AUTO_APPROVE_ADMIN_MSPR_SUBMISSIONS) {
                     $inputs['status'] = 1;
                 }
                 switch ($section) {
                     case "clineval":
                         ClinicalPerformanceEvaluation::create($inputs);
                         break;
                     case "observerships":
                         Observership::create($inputs);
                         break;
                     case 'studentships':
                         Studentship::create($inputs);
                         break;
                     case 'internal_awards':
                         InternalAwardReceipt::create($inputs);
                         break;
                     case 'external_awards':
                         ExternalAwardReceipt::create($inputs);
                         break;
                     case 'contributions':
                         Contribution::create($inputs);
                         break;
                     case 'student_run_electives':
                         StudentRunElective::create($inputs);
                         break;
                     case 'int_acts':
                         InternationalActivity::create($inputs);
                         break;
                     case 'critical_enquiry':
                         if (CriticalEnquiry::get($user_id)) {
                             add_error($translator->translate("mspr_too_many_critical_enquiry"));
                         } else {
                             CriticalEnquiry::create($inputs);
                         }
                         break;
                     case 'community_based_project':
                         if (CommunityBasedProject::get($user_id)) {
                             add_error($translator->translate("mspr_too_many_community_based_project"));
                         } else {
                             CommunityBasedProject::create($inputs);
                         }
                         break;
                     case 'research_citations':
                         ResearchCitation::create($inputs);
                         break;
                 }
             } elseif ($action == "resequence") {
                 switch ($section) {
                     case 'research_citations':
                         ResearchCitations::setSequence($user_id, $inputs['research_citations']);
                         break;
                 }
             } else {
                 //everything else requires an entity
                 if ($entity_id) {
                     $entity = get_mspr_entity($section, $entity_id);
                     if ($entity) {
                         switch ($action) {
                             case "approve":
                                 $entity->approve();
                                 break;
                             case "unapprove":
                                 $entity->unapprove();
                                 break;
                             case "remove":
                                 $entity->delete();
                                 break;
                             case "edit":
                                 if ($entity instanceof Approvable) {
                                     if (AUTO_APPROVE_ADMIN_MSPR_EDITS) {
                                         $inputs['comment'] = "";
                                         $inputs['status'] = 1;
                                     } else {
                                         $inputs['comment'] = $entity->getComment();
                                         $inputs['status'] = $entity->getStatus();
                                     }
                                 }
                                 $entity->update($inputs);
                                 //inputs processed above
                                 break;
                             case "reject":
                                 if (MSPR_REJECTION_SEND_EMAIL) {
                                     $sub_info = get_submission_information($entity);
                                     $reason_type = !$comment ? "noreason" : "reason";
                                     $active_user = User::get($ENTRADA_USER->getID());
                                     if ($active_user && $type) {
                                         submission_rejection_notification($reason_type, array("firstname" => $user->getFirstname(), "lastname" => $user->getLastname(), "email" => $user->getEmail()), array("to_fullname" => $user->getFirstname() . " " . $user->getLastname(), "from_firstname" => $active_user->getFirstname(), "from_lastname" => $active_user->getLastname(), "reason" => clean_input($comment, array("notags", "specialchars")), "submission_details" => $sub_info, "application_name" => APPLICATION_NAME . " MSPR System"));
                                     } else {
                                         add_error($translator->translate("mspr_email_failed"));
                                     }
                                 }
                                 $entity->reject($comment);
                                 break;
                         }
                     } else {
                         add_error($translator->translate("mspr_invalid_entity"));
                     }
                 } else {
                     add_error($translator->translate("mspr_no_entity"));
                 }
             }
         }
         switch ($section) {
             case 'studentships':
                 $studentships = Studentships::get($user);
                 display_status_messages();
                 echo display_studentships($studentships, $type);
                 break;
             case 'clineval':
                 $clinical_evaluation_comments = ClinicalPerformanceEvaluations::get($user);
                 display_status_messages();
                 echo display_clineval($clinical_evaluation_comments, $type);
                 break;
             case 'internal_awards':
                 $internal_awards = InternalAwardReceipts::get($user);
                 display_status_messages();
                 echo display_internal_awards($internal_awards, $type);
                 break;
             case 'external_awards':
                 $external_awards = ExternalAwardReceipts::get($user);
                 display_status_messages();
                 echo display_external_awards($external_awards, $type);
                 break;
             case 'contributions':
                 $contributions = Contributions::get($user);
                 display_status_messages();
                 echo display_contributions($contributions, $type);
                 break;
             case 'student_run_electives':
                 $student_run_electives = StudentRunElectives::get($user);
                 display_status_messages();
                 echo display_student_run_electives($student_run_electives, $type);
                 break;
             case 'observerships':
                 $observerships = Observerships::get($user);
                 display_status_messages();
                 echo display_observerships($observerships, $type);
                 break;
             case 'int_acts':
                 $int_acts = InternationalActivities::get($user);
                 display_status_messages();
                 echo display_international_activities($int_acts, $type);
                 break;
             case 'critical_enquiry':
                 $critical_enquiry = CriticalEnquiry::get($user);
                 display_status_messages();
                 echo display_critical_enquiry($critical_enquiry, $type);
                 break;
             case 'community_based_project':
                 $community_based_project = CommunityBasedProject::get($user);
                 display_status_messages();
                 echo display_community_based_project($community_based_project, $type);
                 break;
             case 'research_citations':
                 $research_citations = ResearchCitations::get($user);
                 display_status_messages();
                 echo display_research_citations($research_citations, $type);
                 break;
         }
     }
 }