/** * Delete row from database that matches this object's $id. * Also, delete the associated document in filecabinet. */ public function delete() { \PHPWS_Core::initModClass('filecabinet', 'Document.php'); \PHPWS_DB::begin(); $db = self::getDb(); $db->addWhere('id', $this->id); $result = $db->delete(); if (\PHPWS_Error::logIfError($result)) { \PHPWS_DB::rollback(); return FALSE; } $doc = new \PHPWS_Document($this->document_fc_id); $result = $doc->delete(); if (\PHPWS_Error::logIfError($result)) { \PHPWS_DB::rollback(); return FALSE; } \PHPWS_DB::commit(); return TRUE; }
public function execute() { /************** * Sanity Checks */ // Required fields check $missing = self::checkRequest(); if (!is_null($missing) && !empty($missing)) { // checkRequest returned some missing fields. $url = 'index.php?module=intern&action=ShowInternship'; $url .= '&missing=' . implode('+', $missing); // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'Please fill in the highlighted fields.'); \NQ::close(); return \PHPWS_Core::reroute($url); } // Sanity check student email if (isset($_REQUEST['student_email']) && preg_match("/@/", $_REQUEST['student_email'])) { $url = 'index.php?module=intern&action=ShowInternship&missing=student_email'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "The student's email address is invalid. No changes were saved. Enter only the username portion of the student's email address. The '@appstate.edu' portion is not necessary."); \NQ::close(); return \PHPWS_Core::reroute($url); } // Sanity check student zip if (isset($_REQUEST['student_zip']) && $_REQUEST['student_zip'] != "" && !preg_match('/^[\\d]{5}$|^[\\d]{5}-[\\d]{4}$/', $_REQUEST['student_zip'])) { $url = 'index.php?module=intern&action=ShowInternship&missing=student_zip'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "The student's zip code is invalid. No changes were saved. The zip code should be 5 digits (no letters, spaces, or punctuation), OR use the extended nine digit form (e.g. 28608-1234)."); \NQ::close(); return \PHPWS_Core::reroute($url); } // Course start date must be before end date if (!empty($_REQUEST['start_date']) && !empty($_REQUEST['end_date'])) { $start = strtotime($_REQUEST['start_date']); $end = strtotime($_REQUEST['end_date']); if ($start > $end) { $url = 'index.php?module=intern&action=ShowInternship&missing=start_date+end_date'; // Restore the values in the fields the user already entered unset($_POST['start_date']); unset($_POST['end_date']); foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } \NQ::simple('intern', Intern\NotifyUI::WARNING, 'The internship start date must be before the end date.'); \NQ::close(); return \PHPWS_Core::reroute($url); } } // Sanity check internship location zip if (isset($_REQUEST['loc_zip']) && $_REQUEST['loc_zip'] != "" && !is_numeric($_REQUEST['loc_zip'])) { $url = 'index.php?module=intern&action=ShowInternship&missing=loc_zip'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "The internship location's zip code is invalid. No changes were saved. Zip codes should be 5 digits only (no letters, spaces, or punctuation)."); \NQ::close(); return \PHPWS_Core::reroute($url); } // Sanity check agency zip if (isset($_REQUEST['agency_zip']) && $_REQUEST['agency_zip'] != "" && !is_numeric($_REQUEST['agency_zip'])) { $url = 'index.php?module=intern&action=ShowInternship&missing=agency_zip'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "The agency's zip code is invalid. No changes were saved. Zip codes should be 5 digits only (no letters, spaces, or punctuation)."); \NQ::close(); return \PHPWS_Core::reroute($url); } // Sanity check supervisor's zip if (isset($_REQUEST['agency_sup_zip']) && $_REQUEST['agency_sup_zip'] != "" && !is_numeric($_REQUEST['agency_sup_zip'])) { $url = 'index.php?module=intern&action=ShowInternship&missing=agency_sup_zip'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "The agency supervisor's zip code is invalid. No changes were saved. Zip codes should be 5 digits only (no letters, spaces, or punctuation)."); \NQ::close(); return \PHPWS_Core::reroute($url); } // Sanity check course number if (isset($_REQUEST['course_no']) && $_REQUEST['course_no'] != '' && (strlen($_REQUEST['course_no']) > 20 || !is_numeric($_REQUEST['course_no']))) { $url = 'index.php?module=intern&action=ShowInternship&missing=course_no'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "The course number provided is invalid. No changes were saved. Course numbers should be less than 20 digits (no letters, spaces, or punctuation)."); \NQ::close(); return \PHPWS_Core::reroute($url); } \PHPWS_DB::begin(); /******************************** * Load the existing internship * */ try { $i = \Intern\InternshipFactory::getInternshipById($_REQUEST['internship_id']); } catch (\Exception $e) { // Rollback and re-throw the exception so that admins gets an email \PHPWS_DB::rollback(); throw $e; } // Load the student object try { $student = StudentProviderFactory::getProvider()->getStudent($i->getBannerId(), $i->getTerm()); } catch (StudentNotFoundException $e) { $student = null; \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, "We couldn't find a matching student in Banner. Your changes were saved, but this student probably needs to contact the Registrar's Office to re-enroll."); \NQ::close(); } $i->faculty_id = $_REQUEST['faculty_id'] > 0 ? $_REQUEST['faculty_id'] : null; $i->department_id = $_REQUEST['department']; $i->start_date = !empty($_REQUEST['start_date']) ? strtotime($_REQUEST['start_date']) : 0; $i->end_date = !empty($_REQUEST['end_date']) ? strtotime($_REQUEST['end_date']) : 0; $i->credits = $_REQUEST['credits'] != '' ? (int) $_REQUEST['credits'] : null; $avg_hours_week = (int) $_REQUEST['avg_hours_week']; $i->avg_hours_week = $avg_hours_week ? $avg_hours_week : null; $i->paid = $_REQUEST['payment'] == 'paid'; $i->stipend = isset($_REQUEST['stipend']) && $i->paid; $i->pay_rate = $_REQUEST['pay_rate']; // Internship experience type if (isset($_REQUEST['experience_type'])) { $i->setExperienceType($_REQUEST['experience_type']); } if ($i->isInternational()) { // Set province $i->loc_province = $_POST['loc_province']; } // Address, city, zip are always set (no matter domestic or international) $i->loc_address = strip_tags($_POST['loc_address']); $i->loc_city = strip_tags($_POST['loc_city']); $i->loc_zip = strip_tags($_POST['loc_zip']); if (isset($_POST['course_subj']) && $_POST['course_subj'] != '-1') { $i->course_subj = strip_tags($_POST['course_subj']); } else { $i->course_subj = null; } // Course info $i->course_no = strip_tags($_POST['course_no']); $i->course_sect = strip_tags($_POST['course_sect']); $i->course_title = strip_tags($_POST['course_title']); // Multipart course if (isset($_POST['multipart'])) { $i->multi_part = 1; } else { $i->multi_part = 0; } if (isset($_POST['multipart']) && isset($_POST['secondary_part'])) { $i->secondary_part = 1; } else { $i->secondary_part = 0; } // Corequisite Course Info if (isset($_POST['corequisite_course_num'])) { $i->corequisite_number = $_POST['corequisite_course_num']; } if (isset($_POST['corequisite_course_sect'])) { $i->corequisite_section = $_POST['corequisite_course_sect']; } // Student Information $i->first_name = $_REQUEST['student_first_name']; $i->middle_name = $_REQUEST['student_middle_name']; $i->last_name = $_REQUEST['student_last_name']; $i->setFirstNameMetaphone($_REQUEST['student_first_name']); $i->setMiddleNameMetaphone($_REQUEST['student_middle_name']); $i->setLastNameMetaphone($_REQUEST['student_last_name']); $i->phone = $_REQUEST['student_phone']; $i->email = $_REQUEST['student_email']; $i->student_address = $_REQUEST['student_address']; $i->student_city = $_REQUEST['student_city']; if ($_REQUEST['student_state'] != '-1') { $i->student_state = $_REQUEST['student_state']; } else { $i->student_state = ""; } $i->student_zip = $_REQUEST['student_zip']; // Student major handling, if more than one major // Make sure we have a student object, since it could be null if the Banner lookup failed if (isset($student) && $student != null) { $majors = $student->getMajors(); } else { $majors = array(); } if (sizeof($majors) > 1) { if (!isset($_POST['major_code'])) { // Student has multiple majors, but user didn't choose one, so just take the first one $i->major_code = $majors[0]->getCode(); $i->major_description = $majors[0]->getDescription(); } else { // User choose a major, so loop over the set of majors until we find the matching major code $code = $_POST['major_code']; foreach ($majors as $m) { if ($m->getCode() == $code) { $major = $m; break; } } $i->major_code = $major->getCode(); $i->major_description = $major->getDescription(); } } else { if (sizeof($majors) == 1) { // Student has exactly one major $i->major_code = $majors[0]->getCode(); $i->major_description = $majors[0]->getDescription(); } } /************ * OIED Certification */ // Check if this has changed from non-certified->certified so we can log it later if ($i->oied_certified == 0 && $_POST['oied_certified_hidden'] == 'true') { // note the change for later $oiedCertified = true; } else { $oiedCertified = false; } if ($_POST['oied_certified_hidden'] == 'true') { $i->oied_certified = 1; } else { if ($_POST['oied_certified_hidden'] == 'false') { $i->oied_certified = 0; } else { $i->oied_certified = 0; } } // If we don't have a state and this is a new internship, // the set an initial state if ($i->id == 0 && is_null($i->state)) { $state = WorkflowStateFactory::getState('CreationState'); $i->setState($state); // Set this initial value } try { $i->save(); } catch (\Exception $e) { // Rollback and re-throw the exception so that admins gets an email \PHPWS_DB::rollback(); throw $e; } // Update agency try { $agency = AgencyFactory::getAgencyById($_REQUEST['agency_id']); } catch (\Exception $e) { // Rollback and re-throw the exception so that admins gets an email \PHPWS_DB::rollback(); throw $e; } // Agency Info $agency->name = $_REQUEST['agency_name']; $agency->address = $_REQUEST['agency_address']; $agency->city = $_REQUEST['agency_city']; $agency->zip = $_REQUEST['agency_zip']; $agency->phone = $_REQUEST['agency_phone']; if ($i->isDomestic()) { $agency->state = $_REQUEST['agency_state'] == '-1' ? null : $_REQUEST['agency_state']; } else { $agency->province = $_REQUEST['agency_province']; $agency->country = $_REQUEST['agency_country'] == '-1' ? null : $_REQUEST['agency_country']; } // Agency Supervisor Info $agency->supervisor_first_name = $_REQUEST['agency_sup_first_name']; $agency->supervisor_last_name = $_REQUEST['agency_sup_last_name']; $agency->supervisor_title = $_REQUEST['agency_sup_title']; $agency->supervisor_phone = $_REQUEST['agency_sup_phone']; $agency->supervisor_email = $_REQUEST['agency_sup_email']; $agency->supervisor_fax = $_REQUEST['agency_sup_fax']; $agency->supervisor_address = $_REQUEST['agency_sup_address']; $agency->supervisor_city = $_REQUEST['agency_sup_city']; $agency->supervisor_zip = $_REQUEST['agency_sup_zip']; if ($i->isDomestic()) { $agency->supervisor_state = $_REQUEST['agency_sup_state']; } else { $agency->supervisor_province = $_REQUEST['agency_sup_province']; $agency->supervisor_country = $_REQUEST['agency_sup_country'] == '-1' ? null : $_REQUEST['agency_sup_country']; } $agency->address_same_flag = isset($_REQUEST['copy_address']) ? 't' : 'f'; try { DatabaseStorage::save($agency); } catch (\Exception $e) { // Rollback and re-throw the exception so that admins gets an email \PHPWS_DB::rollback(); throw $e; } /*************************** * State/Workflow Handling * ***************************/ $t = \Intern\WorkflowTransitionFactory::getTransitionByName($_POST['workflow_action']); $workflow = new \Intern\WorkflowController($i, $t); try { $workflow->doTransition(isset($_POST['notes']) ? $_POST['notes'] : null); } catch (\Intern\Exception\MissingDataException $e) { \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, $e->getMessage()); \NQ::close(); return \PHPWS_Core::reroute('index.php?module=intern&action=ShowInternship&internship_id=' . $i->id); } // Create a ChangeHisotry for the OIED certification. if ($oiedCertified) { $currState = WorkflowStateFactory::getState($i->getStateName()); $ch = new ChangeHistory($i, \Current_User::getUserObj(), time(), $currState, $currState, 'Certified by OIED'); $ch->save(); } \PHPWS_DB::commit(); $workflow->doNotification(isset($_POST['notes']) ? $_POST['notes'] : null); //var_dump($_POST['generateContract']);exit; // If the user clicked the 'Generate Contract' button, then redirect to the PDF view if (isset($_POST['generateContract']) && $_POST['generateContract'] == 'true') { //return \PHPWS_Core::reroute('index.php?module=intern&action=pdf&internship_id=' . $i->id); echo json_encode($i); exit; } else { // Otherwise, redirect to the internship edit view // Show message if user edited internship \NQ::simple('intern', \Intern\UI\NotifyUI::SUCCESS, 'Saved internship for ' . $i->getFullName()); \NQ::close(); return \PHPWS_Core::reroute('index.php?module=intern&action=ShowInternship&internship_id=' . $i->id); } }
public function execute() { PHPWS_Core::initModClass('intern', 'Internship.php'); PHPWS_Core::initModClass('intern', 'Agency.php'); PHPWS_Core::initModClass('intern', 'Department.php'); PHPWS_Core::initModClass('intern', 'Faculty.php'); /************** * Sanity Checks */ // Required fields check $missing = self::checkRequest(); if (!is_null($missing) && !empty($missing)) { // checkRequest returned some missing fields. $url = 'index.php?module=intern&action=edit_internship'; $url .= '&missing=' . implode('+', $missing); // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } NQ::simple('intern', INTERN_ERROR, 'Please fill in the highlighted fields.'); NQ::close(); return PHPWS_Core::reroute($url); } // Sanity check the Banner ID if (!preg_match('/^\\d{9}$/', $_REQUEST['banner'])) { $url = 'index.php?module=intern&action=edit_internship&missing=banner'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } NQ::simple('intern', INTERN_ERROR, "The Banner ID you entered is not valid. No changes were saved. The student's Banner ID should be nine digits only (no letters, spaces, or punctuation)."); NQ::close(); return PHPWS_Core::reroute($url); } // Sanity check student email if (isset($_REQUEST['student_email']) && preg_match("/@/", $_REQUEST['student_email'])) { $url = 'index.php?module=intern&action=edit_internship&missing=student_email'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } NQ::simple('intern', INTERN_ERROR, "The student's email address is invalid. No changes were saved. Enter only the username portion of the student's email address. The '@appstate.edu' portion is not necessary."); NQ::close(); return PHPWS_Core::reroute($url); } // Sanity check student zip if (isset($_REQUEST['student_zip']) && $_REQUEST['student_zip'] != "" && (strlen($_REQUEST['student_zip']) != 5 || !is_numeric($_REQUEST['student_zip']))) { $url = 'index.php?module=intern&action=edit_internship&missing=student_zip'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } NQ::simple('intern', INTERN_ERROR, "The student's zip code is invalid. No changes were saved. Zip codes should be 5 digits only (no letters, spaces, or punctuation)."); NQ::close(); return PHPWS_Core::reroute($url); } // Course start date must be before end date if (!empty($_REQUEST['start_date']) && !empty($_REQUEST['end_date'])) { $start = strtotime($_REQUEST['start_date']); $end = strtotime($_REQUEST['end_date']); if ($start > $end) { $url = 'index.php?module=intern&action=edit_internship&missing=start_date+end_date'; // Restore the values in the fields the user already entered unset($_POST['start_date']); unset($_POST['end_date']); foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } NQ::simple('intern', INTERN_WARNING, 'The internship start date must be before the end date.'); NQ::close(); return PHPWS_Core::reroute($url); } } // Sanity check internship location zip if (isset($_REQUEST['loc_zip']) && $_REQUEST['loc_zip'] != "" && (strlen($_REQUEST['loc_zip']) != 5 || !is_numeric($_REQUEST['loc_zip']))) { $url = 'index.php?module=intern&action=edit_internship&missing=loc_zip'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } NQ::simple('intern', INTERN_ERROR, "The internship location's zip code is invalid. No changes were saved. Zip codes should be 5 digits only (no letters, spaces, or punctuation)."); NQ::close(); return PHPWS_Core::reroute($url); } // Sanity check agency zip if (isset($_REQUEST['agency_zip']) && $_REQUEST['agency_zip'] != "" && (strlen($_REQUEST['agency_zip']) != 5 || !is_numeric($_REQUEST['agency_zip']))) { $url = 'index.php?module=intern&action=edit_internship&missing=agency_zip'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } NQ::simple('intern', INTERN_ERROR, "The agency's zip code is invalid. No changes were saved. Zip codes should be 5 digits only (no letters, spaces, or punctuation)."); NQ::close(); return PHPWS_Core::reroute($url); } // Sanity check supervisor's zip if (isset($_REQUEST['agency_sup_zip']) && $_REQUEST['agency_sup_zip'] != "" && (strlen($_REQUEST['agency_sup_zip']) != 5 || !is_numeric($_REQUEST['agency_sup_zip']))) { $url = 'index.php?module=intern&action=edit_internship&missing=agency_sup_zip'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } NQ::simple('intern', INTERN_ERROR, "The agency supervisor's zip code is invalid. No changes were saved. Zip codes should be 5 digits only (no letters, spaces, or punctuation)."); NQ::close(); return PHPWS_Core::reroute($url); } // Sanity check course number if (isset($_REQUEST['course_no']) && $_REQUEST['course_no'] != '' && (strlen($_REQUEST['course_no']) > 20 || !is_numeric($_REQUEST['course_no']))) { $url = 'index.php?module=intern&action=edit_internship&missing=course_no'; // Restore the values in the fields the user already entered foreach ($_POST as $key => $val) { $url .= "&{$key}={$val}"; } NQ::simple('intern', INTERN_ERROR, "The course number provided is invalid. No changes were saved. Course numbers should be less than 20 digits (no letters, spaces, or punctuation)."); NQ::close(); return PHPWS_Core::reroute($url); } PHPWS_DB::begin(); // Create/Save agency $agency = new Agency(); if (isset($_REQUEST['agency_id'])) { // User is editing internship try { $agency = new Agency($_REQUEST['agency_id']); } catch (Exception $e) { // Rollback and re-throw the exception so that admins gets an email PHPWS_DB::rollback(); throw $e; } } $agency->name = $_REQUEST['agency_name']; $agency->address = $_REQUEST['agency_address']; $agency->city = $_REQUEST['agency_city']; $agency->zip = $_REQUEST['agency_zip']; $agency->phone = $_REQUEST['agency_phone']; if ($_REQUEST['location'] == 'internat') { /* Location is INTERNATIONAL. Country is required. Province was typed in. */ $agency->state = $_REQUEST['agency_state']; $agency->province = $_REQUEST['agency_province']; $agency->country = $_REQUEST['agency_country']; $agency->supervisor_state = $_REQUEST['agency_sup_state']; $agency->supervisor_province = $_REQUEST['agency_sup_province']; $agency->supervisor_country = $_REQUEST['agency_sup_country']; } else { /* Location is DOMESTIC. Country is U.S. State was chosen from drop down */ $agency->state = $_REQUEST['agency_state'] == -1 ? null : $_REQUEST['agency_state']; $agency->country = 'United States'; $agency->supervisor_state = $_REQUEST['agency_sup_state'] == -1 ? null : $_REQUEST['agency_sup_state']; $agency->supervisor_country = 'United States'; } $agency->supervisor_first_name = $_REQUEST['agency_sup_first_name']; $agency->supervisor_last_name = $_REQUEST['agency_sup_last_name']; $agency->supervisor_title = $_REQUEST['agency_sup_title']; $agency->supervisor_phone = $_REQUEST['agency_sup_phone']; $agency->supervisor_email = $_REQUEST['agency_sup_email']; $agency->supervisor_fax = $_REQUEST['agency_sup_fax']; $agency->supervisor_address = $_REQUEST['agency_sup_address']; $agency->supervisor_city = $_REQUEST['agency_sup_city']; $agency->supervisor_zip = $_REQUEST['agency_sup_zip']; $agency->address_same_flag = isset($_REQUEST['copy_address']) ? 't' : 'f'; try { $agencyId = $agency->save(); } catch (Exception $e) { // Rollback and re-throw the exception so that admins gets an email PHPWS_DB::rollback(); throw $e; } /********************************** * Create and/or save the Internship */ if (isset($_REQUEST['internship_id']) && $_REQUEST['internship_id'] != '') { // User is editing internship try { PHPWS_Core::initModClass('intern', 'InternshipFactory.php'); $i = InternshipFactory::getInternshipById($_REQUEST['internship_id']); } catch (Exception $e) { // Rollback and re-throw the exception so that admins gets an email PHPWS_DB::rollback(); throw $e; } } else { $i = new Internship(); } $i->term = $_REQUEST['term']; $i->agency_id = $agencyId; $i->faculty_id = $_REQUEST['faculty_id'] > 0 ? $_REQUEST['faculty_id'] : null; $i->department_id = $_REQUEST['department']; $i->start_date = !empty($_REQUEST['start_date']) ? strtotime($_REQUEST['start_date']) : 0; $i->end_date = !empty($_REQUEST['end_date']) ? strtotime($_REQUEST['end_date']) : 0; // Credit hours must be an integer (because of database column type), // so round the credit hours to nearest int if (isset($_REQUEST['credits'])) { $i->credits = round($_REQUEST['credits']); } $avg_hours_week = (int) $_REQUEST['avg_hours_week']; $i->avg_hours_week = $avg_hours_week ? $avg_hours_week : null; $i->paid = $_REQUEST['payment'] == 'paid'; $i->stipend = isset($_REQUEST['stipend']) && $i->paid; $i->unpaid = $_REQUEST['payment'] == 'unpaid'; $i->pay_rate = $_REQUEST['pay_rate']; // Internship experience type if (isset($_REQUEST['experience_type'])) { $i->setExperienceType($_REQUEST['experience_type']); } // Set fields depending on domestic/international if ($_REQUEST['location'] == 'domestic') { // Set Flags $i->domestic = 1; $i->international = 0; // Set state if ($_POST['loc_state'] != '-1') { $i->loc_state = strip_tags($_POST['loc_state']); } else { $i->loc_state = null; } // Clear province, country $i->loc_province = ''; $i->loc_country = ''; } else { if ($_REQUEST['location'] == 'internat') { // Set flags $i->domestic = 0; $i->international = 1; // Set province, country $i->loc_province = $_POST['loc_province']; $i->loc_country = strip_tags($_POST['loc_country']); // Clear state $i->loc_state = null; } } // Address, city, zip are always set (no matter domestic or international) $i->loc_address = strip_tags($_POST['loc_address']); $i->loc_city = strip_tags($_POST['loc_city']); $i->loc_zip = strip_tags($_POST['loc_zip']); if (isset($_POST['course_subj']) && $_POST['course_subj'] != '-1') { $i->course_subj = strip_tags($_POST['course_subj']); } else { $i->course_subj = null; } // Course info $i->course_no = strip_tags($_POST['course_no']); $i->course_sect = strip_tags($_POST['course_sect']); $i->course_title = strip_tags($_POST['course_title']); // Multipart course if (isset($_POST['multipart'])) { $i->multi_part = 1; } else { $i->multi_part = 0; } if (isset($_POST['multipart']) && isset($_POST['secondary_part'])) { $i->secondary_part = 1; } else { $i->secondary_part = 0; } // Corequisite Course Info if (isset($_POST['corequisite_course_num'])) { $i->corequisite_number = $_POST['corequisite_course_num']; } if (isset($_POST['corequisite_course_sect'])) { $i->corequisite_section = $_POST['corequisite_course_sect']; } // Student Information $i->first_name = $_REQUEST['student_first_name']; $i->middle_name = $_REQUEST['student_middle_name']; $i->last_name = $_REQUEST['student_last_name']; $i->setFirstNameMetaphone($_REQUEST['student_first_name']); $i->setLastNameMetaphone($_REQUEST['student_last_name']); $i->banner = $_REQUEST['banner']; $i->phone = $_REQUEST['student_phone']; $i->email = $_REQUEST['student_email']; $i->level = $_REQUEST['student_level']; // Check the level and record the major/program for this level. // Be sure to set/clear the other leve's major/program to null // in case the user is switching levels. if ($i->getLevel() == 'ugrad') { $i->ugrad_major = $_REQUEST['ugrad_major']; $i->grad_prog = null; } else { if ($i->getLevel() == 'grad') { $i->grad_prog = $_REQUEST['grad_prog']; $i->ugrad_major = null; } } $i->gpa = $_REQUEST['student_gpa']; $i->campus = $_REQUEST['campus']; $i->student_address = $_REQUEST['student_address']; $i->student_city = $_REQUEST['student_city']; if ($_REQUEST['student_state'] != '-1') { $i->student_state = $_REQUEST['student_state']; } else { $i->student_state = ""; } $i->student_zip = $_REQUEST['student_zip']; /* $i->emergency_contact_name = $_REQUEST['emergency_contact_name']; $i->emergency_contact_relation = $_REQUEST['emergency_contact_relation']; $i->emergency_contact_phone = $_REQUEST['emergency_contact_phone']; */ /************ * OIED Certification */ // If OIED certification has changed, then double check permissions $cert = $i->oied_certified == 1 ? true : false; $certSubmitted = $_POST['oied_certified_hidden'] == 'true' ? true : false; $certChanged = $cert != $certSubmitted; if ($certChanged && !Current_User::allow('intern', 'oied_certify')) { $url = "index.php?module=intern&action=edit_internship&internship_id={$i->getId()}"; NQ::simple('intern', INTERN_ERROR, "You do not have permission to change the OIED certification checkbox. No changes were saved."); NQ::close(); return PHPWS_Core::reroute($url); } // Check if this has changed from non-certified->certified so we can log it later if ($i->oied_certified == 0 && $_POST['oied_certified_hidden'] == 'true') { // note the change for later $oiedCertified = true; } else { $oiedCertified = false; } if ($_POST['oied_certified_hidden'] == 'true') { $i->oied_certified = 1; } else { if ($_POST['oied_certified_hidden'] == 'false') { $i->oied_certified = 0; } else { $i->oied_certified = 0; } } // If we don't have a state and this is a new internship, // the set an initial state if ($i->id == 0 && is_null($i->state)) { PHPWS_Core::initModClass('intern', 'WorkflowStateFactory.php'); $state = WorkflowStateFactory::getState('CreationState'); $i->setState($state); // Set this initial value } try { $i->save(); } catch (Exception $e) { // Rollback and re-throw the exception so that admins gets an email PHPWS_DB::rollback(); throw $e; } PHPWS_DB::commit(); /*************************** * State/Workflow Handling * ***************************/ PHPWS_Core::initModClass('intern', 'WorkflowController.php'); PHPWS_Core::initModClass('intern', 'WorkflowTransitionFactory.php'); $t = WorkflowTransitionFactory::getTransitionByName($_POST['workflow_action']); $workflow = new WorkflowController($i, $t); try { $workflow->doTransition(isset($_POST['notes']) ? $_POST['notes'] : null); } catch (MissingDataException $e) { NQ::simple('intern', INTERN_ERROR, $e->getMessage()); NQ::close(); return PHPWS_Core::reroute('index.php?module=intern&action=edit_internship&internship_id=' . $i->id); } // Create a ChangeHisotry for the OIED certification. if ($oiedCertified) { $currState = WorkflowStateFactory::getState($i->getStateName()); $ch = new ChangeHistory($i, Current_User::getUserObj(), time(), $currState, $currState, 'Certified by OIED'); $ch->save(); } $workflow->doNotification(isset($_POST['notes']) ? $_POST['notes'] : null); if (isset($_REQUEST['internship_id'])) { // Show message if user edited internship NQ::simple('intern', INTERN_SUCCESS, 'Saved internship for ' . $i->getFullName()); NQ::close(); return PHPWS_Core::reroute('index.php?module=intern&action=edit_internship&internship_id=' . $i->id); } else { NQ::simple('intern', INTERN_SUCCESS, 'Added internship for ' . $i->getFullName()); NQ::close(); return PHPWS_Core::reroute('index.php?module=intern&action=edit_internship&internship_id=' . $i->id); } }
/** * Move row in a table based on a column designating the current order * direction == 1 means INCREASE order by one * direction == -1 means DECREASE order by one * @param string order_column Table column that contains the order of the entries * @param string id_column Name of the id_column * @param integer id Id of current row * @param integer direction Direction to move the row */ public function moveRow($order_column, $id_column, $id, $direction = 1) { if (!($direction == 1 || $direction == -1)) { if (strtolower($direction) == 'down') { $direction = 1; } elseif (strtolower($direction) == 'up') { $direction = -1; } else { return false; } } $total_rows = $this->count(); if ($total_rows < 2) { return; } $db = clone $this; $db->reset(); $db->addWhere($id_column, $id); $db->addColumn($order_column); $current_order = $db->select('one'); if ($current_order == 1 && $direction == -1) { // moving up when current item is at top of list // need to shift all other items down and pop this on the end PHPWS_DB::begin(); if (PHPWS_Error::logIfError($this->reduceColumn($order_column))) { PHPWS_DB::rollback(); return false; } $db->reset(); $db->addWhere($id_column, $id); $db->addValue($order_column, $total_rows); if (PHPWS_Error::logIfError($db->update())) { PHPWS_DB::rollback(); return false; } PHPWS_DB::commit(); unset($db); return true; } elseif ($current_order == $total_rows && $direction == 1) { // moving down when current item is at bottom/end of list // need to shift all other items up and shift this on the beginning PHPWS_DB::begin(); if (PHPWS_Error::logIfError($this->incrementColumn($order_column))) { PHPWS_DB::rollback(); return false; } $db->reset(); $db->addWhere($id_column, $id); $db->addValue($order_column, 1); if (PHPWS_Error::logIfError($db->update())) { PHPWS_DB::rollback(); return false; } PHPWS_DB::commit(); unset($db); return true; } else { PHPWS_DB::begin(); $db = clone $this; $db->addWhere($order_column, $current_order + $direction); $db->addValue($order_column, $current_order); if (PHPWS_Error::logIfError($db->update())) { PHPWS_DB::rollback(); return false; } $db = clone $this; $db->addWhere($id_column, $id); $db->addValue($order_column, $current_order + $direction); if (PHPWS_Error::logIfError($db->update())) { PHPWS_DB::rollback(); return false; } unset($db); return true; } }
/** * @author Matthew McNaney * @version $Id$ */ function filecabinet_update(&$content, $version) { $home_dir = PHPWS_Boost::getHomeDir(); switch ($version) { case version_compare($version, '1.0.1', '<'): $content[] = '<pre>File Cabinet versions prior to 1.0.1 are not supported. Please download version 1.0.2.</pre>'; break; case version_compare($version, '1.0.2', '<'): $content[] = '<pre>'; $db = new PHPWS_DB('folders'); if (!$db->isTableColumn('key_id')) { if (PHPWS_Error::logIfError($db->addTableColumn('key_id', 'int NOT NULL default 0'))) { $content[] = '--- An error occurred when trying to add key_id as a column to the folders table.</pre>'; return false; } $content[] = '--- Successfully added key_id column to folders table.'; $db2 = new PHPWS_DB('phpws_key'); $db2->addWhere('module', 'filecabinet'); $db2->delete(); $content[] = '--- Deleted false folder keys.'; $db->reset(); PHPWS_Core::initModClass('filecabinet', 'Folder.php'); $result = $db->getObjects('Folder'); if (!empty($result)) { foreach ($result as $folder) { $folder->saveKey(true); } } } $content[] = ' 1.0.2 changes -------------- + 1.0.0 update was missing key_id column addition to folders table. </pre>'; case version_compare($version, '1.1.0', '<'): $content[] = '<pre>'; if (!checkMultimediaDir($content, $home_dir)) { return false; } if (!is_dir($home_dir . 'files/filecabinet/incoming')) { if (is_writable($home_dir . 'files/filecabinet') && @mkdir($home_dir . 'files/filecabinet/incoming')) { $content[] = '--- "files/filecabinet/incoming" directory created.'; } else { $content[] = 'File Cabinet 1.1.0 is unable to create a "filecabinet/incoming" directory. It is not required but if you want to classify files you will need to create it yourself. Example: mkdir phpwebsite/files/filecabinet/incoming/</pre>'; return false; } } $source_dir = PHPWS_SOURCE_DIR . 'mod/filecabinet/templates/filters/'; $dest_dir = $home_dir . 'templates/filecabinet/filters/'; if (!is_dir($dest_dir)) { if (!PHPWS_File::copy_directory($source_dir, $dest_dir)) { $content[] = '--- FAILED copying templates/filters/ directory locally.</pre>'; return false; } } $files = array('templates/manager/pick.tpl', 'templates/classify_file.tpl', 'templates/classify_list.tpl', 'templates/image_edit.tpl', 'templates/multimedia_edit.tpl', 'templates/multimedia_grid.tpl', 'templates/style.css', 'templates/settings.tpl', 'conf/config.php'); if (PHPWS_Boost::updateFiles($files, 'filecabinet')) { $content[] = '--- Copied the following files:'; } else { $content[] = '--- FAILED copying the following files:'; } $content[] = " " . implode("\n ", $files); $db = new PHPWS_DB('images'); if (!$db->isTableColumn('parent_id')) { if (PHPWS_Error::logIfError($db->addTableColumn('parent_id', 'int NOT NULL default 0'))) { $content[] = 'Could not create parent_id column in images table.</pre>'; return false; } } if (!$db->isTableColumn('url')) { if (PHPWS_Error::logIfError($db->addTableColumn('url', 'varchar(255) NULL'))) { $content[] = 'Could not create url column in images table.</pre>'; return false; } } if (!PHPWS_DB::isTable('multimedia')) { $result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/multimedia.sql'); if (!PHPWS_Error::logIfError($result)) { $content[] = '--- Multimedia table created successfully.'; } else { $content[] = '--- Failed to create multimedia table.</pre>'; return false; } } $content[] = ' 1.1.0 changes -------------- + Fixed authorized check when unpinning folders + Images can now be linked to other pages. + Resized images can now be linked to their parent image. + Clip option moved outside edit_folder permissions when viewing images. + Added writable directory check before allowing new folders to be created. + Fixed some error messages in File_Common. + Commented out ext variable in File_Common. Doesn\'t appear to be in use. + Created setDirectory function for File_Common. Assures trailing forward slash on directory name. + Removed itemname variable from Document_Manager + Added ability to classify uploaded files. + New folder class - Multimedia + Multimedia files can be clipped and pasted via SmartTags. </pre> '; case version_compare($version, '1.2.0', '<'): $content[] = '<pre>'; $files = array('img/no_image.png', 'conf/config.php', 'conf/video_types.php', 'conf/embedded.php', 'javascript/folder_contents/head.js', 'javascript/clear_image/head.js', 'javascript/clear_image/body.js', 'javascript/pick_image/head.js', 'templates/image_folders.tpl', 'templates/settings.tpl', 'templates/style.css', 'templates/image_view.tpl', 'templates/multimedia_view.tpl', 'templates/style.css', 'img/video_generic.png', 'templates/image_edit.tpl', 'conf/error.php'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/1_2_0.txt'); } $content[] = '</pre>'; case version_compare($version, '1.2.1', '<'): $content[] = '<pre>'; if (!PHPWS_DB::isTable('filecabinet_pins')) { $db = new PHPWS_DB('filecabinet_pins'); $db->addValue('key_id', 'int not null default 0'); $db->addValue('folder_id', 'int not null default 0'); if (PHPWS_Error::logIfError($db->createTable())) { $content[] = 'Failed to create filecabinet_pins table.</pre>'; return false; } $content[] = '--- Created filecabinet_pins table.'; } $files = array('templates/settings.tpl'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/1_2_1.txt'); } $content[] = '</pre>'; case version_compare($version, '1.2.2', '<'): $content[] = '<pre>'; $files = array('templates/image_edit.tpl'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/1_2_2.txt'); } $content[] = '</pre>'; case version_compare($version, '1.3.0', '<'): $content[] = '<pre>'; $db = new PHPWS_DB('folders'); if (!$db->isTableColumn('module_created')) { if (PHPWS_Error::logIfError($db->addTableColumn('module_created', 'varchar(40) default null'))) { $content[] = '--- Could not create column module_created on folders table.</pre>'; return false; } else { $content[] = '--- Created module_created column on folders table.'; } } $db = new PHPWS_DB('multimedia'); $result = $db->addTableColumn('thumbnail', 'varchar(255) not null'); if (PHPWS_Error::logIfError($result)) { $content[] = '--- Unable to add thumbnail column to multimedia table.</pre>'; return false; } else { $content[] = '--- Added thumbnail column to multimedia table.'; } $s1 = PHPWS_SOURCE_DIR . 'mod/filecabinet/templates/filters/flash/'; $d1 = $home_dir . 'templates/filecabinet/filters/flash/'; $s2 = PHPWS_SOURCE_DIR . 'mod/filecabinet/img/icons/'; $d2 = $home_dir . 'images/mod/filecabinet/icons/'; if (PHPWS_File::copy_directory($s1, $d1)) { $content[] = "--- Successfully copied {$s1} to {$d1}"; } else { $content[] = "--- Failed to copy {$s1} to {$d1}</pre>"; return false; } if (PHPWS_File::copy_directory($s2, $d2)) { $content[] = "--- Successfully copied {$s2} to {$d2}"; } else { $content[] = "--- Failed to copy {$s2} to {$d2}</pre>"; return false; } $content[] = ''; $files = array('conf/error.php', 'conf/config.php', 'templates/filters/flash.tpl', 'templates/file_list.tpl', 'templates/multimedia_edit.tpl', 'templates/settings.tpl', 'templates/style.css', 'templates/thumbnail.tpl', 'templates/image_edit.tpl', 'javascript/pick_image/head.js', 'templates/folder_list.tpl', 'templates/manager/pick.tpl', 'img/delete.png'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/1_3_0.txt'); } $content[] = '</pre>'; case version_compare($version, '1.4.0', '<'): $content[] = '<pre>'; $files = array('javascript/folder_contents/head.js', 'javascript/folder_contents/scripts.js', 'javascript/pick_image/head.js', 'javascript/pick_image/scripts.js', 'javascript/clear_image/body.js', 'javascript/clear_image/head.js', 'templates/style.css', 'templates/settings.tpl'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/1_4_0.txt'); } $content[] = '</pre>'; case version_compare($version, '1.4.1', '<'): $content[] = '<pre>'; $db = new PHPWS_DB('folders'); if (!$db->isTableColumn('module_created')) { if (PHPWS_Error::logIfError($db->addTableColumn('module_created', 'varchar(40) default null'))) { $content[] = '--- Could not create column module_created on folders table.</pre>'; return false; } else { $content[] = '--- Created module_created column on folders table.'; } } $content[] = '1.4.1 changes -------------- + module_created column missing from > 1.3.0 install. </pre>'; case version_compare($version, '1.4.2', '<'): $content[] = '<pre> 1.4.2 changes -------------- + Removed test echo 1 + moved all defines to one file. </pre>'; case version_compare($version, '2.0.0', '<'): $content[] = '<pre>'; if (PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'mod/filecabinet/templates/', $home_dir . 'templates/filecabinet/')) { $content[] = '--- Copied complete templates directory.'; } else { $content[] = '--- Could not copy complete templates directory. Use revert or copy manually.'; } if (PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'mod/filecabinet/img/', $home_dir . 'images/mod/filecabinet/')) { $content[] = '--- Copied complete images directory.'; } else { $content[] = '--- Could not copy complete images directory. Use revert or copy manually.'; } if (PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'mod/filecabinet/conf/', $home_dir . 'config/filecabinet/')) { $content[] = '--- Copied complete configuration directory.'; } else { $content[] = '--- Could not copy complete configuration directory. Use revert or copy manually.'; } if (PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'mod/filecabinet/javascript/', $home_dir . 'javascript/modules/filecabinet/')) { $content[] = '--- Copied complete javascript directory.'; } else { $content[] = '--- Could not copy complete javascript directory. Use revert or copy manually.'; } if (!PHPWS_DB::isTable('fc_convert')) { $result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/fc_convert.sql'); if (!PHPWS_Error::logIfError($result)) { $content[] = '--- File conversion table created successfully.'; } else { $content[] = '--- Failed to create File conversion table.</pre>'; return false; } } if (!PHPWS_DB::isTable('fc_file_assoc')) { $result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/file_assoc.sql'); if (!PHPWS_Error::logIfError($result)) { $content[] = '--- File assoc table created successfully.'; } else { $content[] = '--- Failed to create File assoc table.</pre>'; return false; } } $db = new PHPWS_DB('multimedia'); if (!$db->isTableColumn('duration')) { if (PHPWS_Error::logIfError($db->addTableColumn('duration', 'int not null default 0'))) { $content[] = '--- Failed to create duration column on multimedia table.</pre>'; return false; } else { $content[] = '--- Created duration column on multimedia table.'; } } if (!$db->isTableColumn('embedded')) { if (PHPWS_Error::logIfError($db->addTableColumn('embedded', 'smallint not null default 0'))) { $content[] = 'Failed to create embedded column on multimedia table.</pre>'; return false; } else { $content[] = '--- Created embedded column on multimedia table.'; } } PHPWS_Core::initModClass('filecabinet', 'Multimedia.php'); $result = $db->getObjects('PHPWS_Multimedia'); if ($result) { foreach ($result as $mm) { $mm->loadDimensions(); PHPWS_Error::logIfError($mm->save()); } } $content[] = '--- Durations added to multimedia files.'; fc_update_parent_links(); if (!checkMultimediaDir($content, $home_dir)) { return false; } if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/2_0_0.txt'); } $content[] = '</pre>'; case version_compare($version, '2.0.1', '<'): $content[] = '<pre>2.0.1 changes ------------- + Updated youTube import. + Removed unused code.</pre>'; case version_compare($version, '2.1.0', '<'): $content[] = '<pre>'; $files = array('templates/image_view.tpl', 'templates/settings.tpl', 'javascript/pick_file/head.js', 'javascript/pick_file/scripts.js', 'javascript/update_file/head.js', 'templates/file_manager/placeholder.tpl', 'templates/document_edit.tpl', 'templates/image_edit.tpl', 'templates/multimedia_edit.tpl', 'templates/edit_folder.tpl', 'templates/embed_edit.tpl', 'templates/style.css', 'templates/file_manager/folder_content_view.tpl', 'templates/file_manager/resize.tpl'); fc_updatefiles($files, $content); $db = new PHPWS_DB('folders'); $db->begin(); if (PHPWS_Error::logIfError($db->addTableColumn('max_image_dimension', 'smallint not null default 0'))) { $content[] = '--- Unable to add max_image_dimension column to folders table.'; $db->rollback(); return false; } else { $content[] = '--- Added max_image_dimension column to folders table.'; } $db = new PHPWS_DB('fc_file_assoc'); if (PHPWS_Error::logIfError($db->addTableColumn('width', 'smallint NOT NULL default 0'))) { $content[] = '--- Unable to add width column to fc_file_assoc.'; $db->rollback(); return false; } else { $content[] = '--- Added width column to fc_file_assoc table'; } if (PHPWS_Error::logIfError($db->addTableColumn('height', 'smallint NOT NULL default 0'))) { $content[] = '--- Unable to add height column to fc_file_assoc.'; $db->rollback(); return false; } else { $content[] = '--- Added height column to fc_file_assoc table'; } if (PHPWS_Error::logIfError($db->addTableColumn('cropped', 'smallint NOT NULL default 0'))) { $content[] = '--- Unable to add cropped column to fc_file_assoc.'; $db->rollback(); return false; } else { $content[] = '--- Added cropped column to fc_file_assoc table'; } $db->commit(); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/2_1_0.txt'); } $content[] = '</pre>'; case version_compare($version, '2.2.0', '<'): $content[] = '<pre>'; $db = new PHPWS_DB('fc_file_assoc'); if (PHPWS_Error::logIfError($db->addTableColumn('vertical', 'smallint not null default 0'))) { $content[] = 'Unable to create vertical column in fc_file_assoc table.'; return false; } if (PHPWS_Error::logIfError($db->addTableColumn('num_visible', 'smallint not null default 3'))) { $content[] = 'Unable to create num_visible column in fc_file_assoc table.'; return false; } $db->dropTableColumn('cropped'); $db = new PHPWS_DB('modules'); $db->addWhere('title', 'filecabinet'); $db->addValue('unregister', 1); PHPWS_Error::logIfError($db->update()); $content[] = 'Unregister flag set in modules table.'; $files = array('javascript/jcaro_lite/', 'javascript/shutter/', 'javascript/pick_file/', 'javascript/update_file/head.js', 'javascript/update_file/default.php', 'javascript/clear_file/body.js', 'javascript/clear_file/head.js', 'javascript/clear_file/default.php', 'templates/image_view.tpl', 'templates/carousel_horz.tpl', 'templates/carousel_vert.tpl', 'templates/classify_list.tpl', 'templates/ss_box.tpl', 'templates/file_manager/carousel_pick.tpl', 'templates/file_manager/folder_content_view.tpl', 'templates/settings.tpl', 'templates/style.css', 'templates/file_list.tpl', 'templates/folder_list.tpl', 'templates/pinned.tpl', 'img/add.png', 'img/arrow_left.png', 'img/arrow_right.png', 'conf/icons.php', 'conf/config.php'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/2_2_0.txt'); } case version_compare($version, '2.2.1', '<'): $content[] = '<pre> 2.2.1 changes ----------------------- + Fixed folder deletion. + Clipped documents and images now have full pathing. + Fixed document smarttag</pre>'; case version_compare($version, '2.2.2', '<'): $content[] = '<pre>'; $files = array('img/mime_types/', 'templates/document_download.tpl', 'templates/file_view.css', 'templates/multi_doc_download.tpl'); fc_updatefiles($files, $content); $content[] = '2.2.2 changes ----------------------- + Fixed edit icon in document view. Needed to be salted. + Added error check to prevent possible divide by zero error. + Resized mime type icons + Changed the document download windows. Simplified. + Fixed image edit link. + Added pptm to known types. + Fixed permission checks on folders.</pre>'; case version_compare($version, '2.2.3', '<'): $content[] = '<pre>2.2.3 changes ----------------------- + Fixed document delete link</pre>'; case version_compare($version, '2.2.4', '<'): $content[] = '<pre>'; $files = array('templates/fckeditor.tpl', 'templates/fckdocuments.tpl', 'templates/fck.css', 'templates/fckimages.tpl', 'templates/fckfolders.tpl', 'templates/folder_list.tpl', 'templates/settings.tpl', 'img/folder.gif', 'javascript/fckeditor/'); fc_updatefiles($files, $content); $content[] = '2.2.4 changes ----------------------- + Error checking added to document upload. + Fixed multimedia folder pager. + Added method for fixing document directories. + Added file search to folder pager. + Added File Cabinet FCKeditor interaction. + Cleaned up so interface issues. </pre>'; case version_compare($version, '2.2.5', '<'): $content[] = '<pre>2.2.5 changes ----------------------- + Fixed bug that displayed error message on document upload. + Proper error message now on document uploaded to unwritable directory + Directory check on unwritable directory prevents upload link</pre>'; case version_compare($version, '2.2.6', '<'): $content[] = '<pre>'; $files = array('javascript/fckeditor/head.js', 'templates/fck.css'); fc_updatefiles($files, $content); $content[] = '2.2.6 changes ----------------------- + Fixed bug with editing Multimedia. + Fixed bug with File Cabinet in FCKeditor not loading folders properly. </pre>'; case version_compare($version, '2.2.7', '<'): $content[] = '<pre>'; $files = array('javascript/fckeditor/head.js', 'templates/filters/media/mediaplayer.swf', 'templates/filters/media/yt.swf'); fc_updatefiles($files, $content); $content[] = '2.2.7 changes ----------------------- + Added trim to ffmpeg file directory + Added description to search for files + Media player updated to latest version. + FCKeditor media insertion had problems with any media other than YouTube embeds. SmartTag for media is displayed instead.</pre>'; case version_compare($version, '2.3.0', '<'): $content[] = '<pre>2.3.0 changes --------------------- + Icon class implemented. + Video player changed to Flowplayer. + Lightbox option for public folders. + Image carousel switched to jcarousel with Lightbox usage. + Updated to work with core updates.</pre>'; case version_compare($version, '2.3.1', '<'): $content[] = '<pre>2.3.1 changes --------------------- + Setting added to allow direct links to documents + Fixed captioned image template</pre>'; case version_compare($version, '2.3.2', '<'): $content[] = '<pre>2.3.2 changes --------------------- + Changing public flag to private on document folders creates .htaccess file preventing world access + Added mp4/m4v to multimedia class. </pre>'; case version_compare($version, '2.4.0', '<'): $content[] = '<pre>2.4.0 changes --------------------- + Heavy ckeditor modifications. + rtmp support added. + Removed FCK code where found. + Minified some scripts. + Failed image upload will now display an error. + Can now add Access shortcut to a document. + Various bug fixes </pre>'; case version_compare($version, '2.4.1', '<'): $content[] = '<pre>2.4.1 changes ----------------------- + Fixed a possible XSS vulnerability discovered by Jakub Galczyk. + Users must have some File Cabinet permission to use the File Manager. </pre>'; case version_compare($version, '2.4.2', '<'): $content[] = '<pre>2.4.2 changes ----------------------- + Added error logging to image resize. </pre>'; case version_compare($version, '2.4.3', '<'): $content[] = '<pre>2.4.3 changes ----------------------- + Added checkbox in Settings to turn off autofloating of images in the ckeditor. </pre>'; case version_compare($version, '2.4.4', '<'): $content[] = '<pre>2.4.4 changes ----------------------- + Removed clipboard functionality. Confused users and was not + Bootstrap icons and styles added. </pre>'; case version_compare($version, '2.5.0', '<'): $content[] = '<pre>2.5.0 changes ----------------------- + img-responsive added to inserted images to work with Bootstrap + removed image widths and heights + Cropping and resizing removed from manager + Manager made larger. + Manager upload header fixed position </pre>'; case version_compare($version, '2.6.0', '<'): $content[] = <<<EOF <pre>2.6.0 changes ---------------- + Removed call to updateTag as it does not work. + Removed calls to Layout Cache (which was removed) + Updated filecabinet to work with ckeditor 4. + Updated ckeditor 4 filecabinet pop up layout. + Thumbnails of uploaded images are not shown. </pre> EOF; case version_compare($version, '2.7.0', '<'): $db = \Database::newDB(); $t1 = $db->addTable('folders'); $t1->addValue('module_created', null); $db->update(); $content[] = <<<EOF <pre>2.7.0 changes ---------------- + Javascript windows replaced with Bootstrap modal dropdowns. + Fixed thumbnail form. + Removed module_created for all folders. </pre> EOF; case version_compare($version, '2.8.0', '<'): $content[] = <<<EOF <pre>2.8.0 changes ---------------- + Rewrote CKEditor interaction with Filecabinet. Images and documents functional, multimedia uploads not complete. </pre> EOF; return true; } }