public function configureWidgets() { $this->setWidget('student_id', new sfWidgetFormInputHidden()); $this->setWidget('school_year_id', new sfWidgetFormInputHidden()); $this->setWidget('request_date', new csWidgetFormDateInput()); $this->setWidget('resolution_date', new csWidgetFormDateInput()); $this->getWidget('disciplinary_sanction_type_id')->setOption('add_empty', true); $this->getWidget('sanction_type_id')->setOption('add_empty', true); $applicants_criteria = new Criteria(); PersonPeer::doSelectOrderedCriteria($applicants_criteria); $results = array(); foreach (PersonalPeer::doSelect(new Criteria()) as $personal) { $results[$personal->getPersonId()] = $personal->getPersonId(); } foreach (TeacherPeer::doSelect(new Criteria()) as $teacher) { $results[$teacher->getPersonId()] = $teacher->getPersonId(); } $applicants_criteria->add(PersonPeer::ID, $results, Criteria::IN); $this->getWidget('applicant_id')->setOption('criteria', $applicants_criteria); $preceptors_criteria = new Criteria(); PersonPeer::doSelectOrderedCriteria($preceptors_criteria); $preceptors_criteria->addJoin(PersonPeer::ID, PersonalPeer::PERSON_ID); $this->getWidget('responsible_id')->setOption('criteria', $preceptors_criteria); $this->setWidget('document', new sfWidgetFormInputFile()); if ($this->getObject()->getDocument()) { $this->setWidget('current_document', new mtWidgetFormPartial(array('module' => 'student_disciplinary_sanction', 'partial' => 'downloable_document', 'form' => $this))); $this->setWidget('delete_document', new sfWidgetFormInputCheckbox()); $this->getWidgetSchema()->moveField('delete_document', sfWidgetFormSchema::BEFORE, 'document'); $this->getWidgetSchema()->moveField('current_document', sfWidgetFormSchema::BEFORE, 'delete_document'); } }
public function configure() { $this->setWidget('student_id', new sfWidgetFormInputHidden()); $this->setWidget('school_year_id', new sfWidgetFormInputHidden()); unset($this['resolution_date']); $this->setWidget('request_date', new csWidgetFormDateInput()); $this->setValidator('request_date', new mtValidatorDateString()); $this->getWidgetSchema()->setLabel('request_date', 'Day'); $this->getWidgetSchema()->setHelp('value', 'This field represents the value of the disciplinary sanction'); $this->setValidator('value', new sfValidatorNumber(array('required' => true))); $this->getWidget('disciplinary_sanction_type_id')->setOption('add_empty', true); $this->getWidget('sanction_type_id')->setOption('add_empty', true); $applicants_criteria = new Criteria(); PersonPeer::doSelectOrderedCriteria($applicants_criteria); $results = array(); foreach (PersonalPeer::doSelect(new Criteria()) as $personal) { $results[$personal->getPersonId()] = $personal->getPersonId(); } foreach (TeacherPeer::doSelect(new Criteria()) as $teacher) { $results[$teacher->getPersonId()] = $teacher->getPersonId(); } $applicants_criteria->add(PersonPeer::ID, $results, Criteria::IN); $this->getWidget('applicant_id')->setOption('criteria', $applicants_criteria); $preceptors_criteria = new Criteria(); PersonPeer::doSelectOrderedCriteria($preceptors_criteria); $preceptors_criteria->addJoin(PersonPeer::ID, PersonalPeer::PERSON_ID); $this->getWidget('responsible_id')->setOption('criteria', $preceptors_criteria); $this->setWidget('document', new sfWidgetFormInputFile()); $this->setValidator('document', new sfValidatorFile(array('path' => StudentDisciplinarySanction::getDocumentDirectory(), 'max_size' => '2097152', 'required' => false))); $this->getWidgetSchema()->setHelp('document', 'The file must be of the following types: jpeg, jpg, gif, png, pdf.'); $this->getValidator('document')->setOption('mime_categories', array('web_images' => array('image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/gif'), 'documents' => array('application/pdf'))); $this->getWidgetSchema()->moveField('observation', sfWidgetFormSchema::LAST); $this->getWidgetSchema()->moveField('document', sfWidgetFormSchema::AFTER, 'responsible_id'); if ($this->getObject()->getDocument()) { $this->setWidget('current_document', new mtWidgetFormPartial(array('module' => 'student_disciplinary_sanction', 'partial' => 'downloable_document', 'form' => $this))); $this->setValidator('current_document', new sfValidatorPass(array('required' => false))); $this->setWidget('delete_document', new sfWidgetFormInputCheckbox()); $this->setValidator('delete_document', new sfValidatorBoolean(array('required' => false))); $this->getWidgetSchema()->moveField('delete_document', sfWidgetFormSchema::BEFORE, 'document'); $this->getWidgetSchema()->moveField('current_document', sfWidgetFormSchema::BEFORE, 'delete_document'); } }
public function executeList() { $this->personals = PersonalPeer::doSelect(new Criteria()); }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(PersonalPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(PersonalPeer::DATABASE_NAME); $criteria->add(PersonalPeer::IDPERSONAL, $pks, Criteria::IN); $objs = PersonalPeer::doSelect($criteria, $con); } return $objs; }
/** * Gets an array of Personal objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Usuaris has previously been saved, it will retrieve * related PersonalsRelatedByUsuariupdateid from storage. If this Usuaris is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array Personal[] * @throws PropelException */ public function getPersonalsRelatedByUsuariupdateid($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(UsuarisPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collPersonalsRelatedByUsuariupdateid === null) { if ($this->isNew()) { $this->collPersonalsRelatedByUsuariupdateid = array(); } else { $criteria->add(PersonalPeer::USUARIUPDATEID, $this->usuariid); PersonalPeer::addSelectColumns($criteria); $this->collPersonalsRelatedByUsuariupdateid = PersonalPeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(PersonalPeer::USUARIUPDATEID, $this->usuariid); PersonalPeer::addSelectColumns($criteria); if (!isset($this->lastPersonalRelatedByUsuariupdateidCriteria) || !$this->lastPersonalRelatedByUsuariupdateidCriteria->equals($criteria)) { $this->collPersonalsRelatedByUsuariupdateid = PersonalPeer::doSelect($criteria, $con); } } } $this->lastPersonalRelatedByUsuariupdateidCriteria = $criteria; return $this->collPersonalsRelatedByUsuariupdateid; }
public function executeForgotpassword() { $email = $this->getRequestParameter('forgotemail'); $c = new Criteria(); $c->add(PersonalPeer::EMAIL, $email); $personals = PersonalPeer::doSelect($c); $count = 0; $ids = ""; foreach ($personals as $personal) { $user = $personal->getUser(); $name = $user->getFullname(); $newpassword = $this->generatePassword(); $user->setPassword($newpassword); $user->save(); $sendermail = sfConfig::get('app_from_mail'); $sendername = sfConfig::get('app_from_name'); $to = $email; $subject = "Password reset request for ITBHU Global Org"; $body = ' Dear ' . $name . ', As per your request, your password has been reset. Your Login Details are: Username: '******' Password: '******' Admin, ITBHU Global '; $mail = myUtility::sendmail($sendermail, $sendername, $sendermail, $sendername, $sendermail, $to, $subject, $body); $count++; if ($ids) { $ids .= "\n" . $user->getUsername(); } else { $ids .= $user->getUsername(); } } if ($count > 1) { $sendermail = sfConfig::get('app_from_mail'); $sendername = sfConfig::get('app_from_name'); $to = sfConfig::get('app_to_adminmail'); $subject = "Password reset for multiple users"; $body = ' Dear Admin, As per a request, the password has been reset for the following usernames: ' . $ids . ' The common email used here is: ' . $email . ' System, ITBHU Global '; $mail = myUtility::sendmail($sendermail, $sendername, $sendermail, $sendername, $sendermail, $to, $subject, $body); } //$this->setFlash('fp', 'If the Email provided by you is correct and registered, You\'ll recieve a mail soon.' ); }
public function getPersonals($criteria = null, $con = null) { include_once 'lib/model/om/BasePersonalPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collPersonals === null) { if ($this->isNew()) { $this->collPersonals = array(); } else { $criteria->add(PersonalPeer::USER_ID, $this->getId()); PersonalPeer::addSelectColumns($criteria); $this->collPersonals = PersonalPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(PersonalPeer::USER_ID, $this->getId()); PersonalPeer::addSelectColumns($criteria); if (!isset($this->lastPersonalCriteria) || !$this->lastPersonalCriteria->equals($criteria)) { $this->collPersonals = PersonalPeer::doSelect($criteria, $con); } } } $this->lastPersonalCriteria = $criteria; return $this->collPersonals; }
/** * This method returns an array of preceptors related with the course. * * @return <array> Preceptor[] */ public function getPreceptors() { $c = new Criteria(); $c->add(CoursePreceptorPeer::COURSE_ID, $this->getId()); $c->addJoin(CoursePreceptorPeer::PRECEPTOR_ID, PersonalPeer::ID); $c->setDistinct(); return PersonalPeer::doSelect($c); }
public function executeNewregister() { /* $c = new Criteria(); $c->addJoin(UserPeer::ID, PersonalPeer::USER_ID); $c->addJoin(UserPeer::BRANCH_ID, BranchPeer::ID); $c->add(UserPeer::ISLOCKED, '3'); $this->personal = PersonalPeer::doSelect($c); */ if ($this->getUser()->hasCredential('admin')) { $c = new Criteria(); $c->addJoin(UserPeer::ID, PersonalPeer::USER_ID); $c->addJoin(UserPeer::DEGREE_ID, DegreePeer::ID); $c->addJoin(UserPeer::BRANCH_ID, BranchPeer::ID); $c->add(UserPeer::ISLOCKED, '3'); $this->personal = PersonalPeer::doSelect($c); } else { if ($this->getUser()->hasCredential('auth')) { $me = UserPeer::retrieveByPK($this->getUser()->getAttribute('userid')); $c = new Criteria(); $c->addJoin(UserPeer::ID, PersonalPeer::USER_ID); $c->add(UserPeer::ISLOCKED, '3'); $c->add(UserPeer::GRADUATIONYEAR, $me->getGraduationyear()); $c->add(UserPeer::BRANCH_ID, $me->getBranchId()); $c->add(UserPeer::AUTHCODE, sfConfig::get('app_authcode_classauth')); $this->personalca = PersonalPeer::doSelect($c); $ugyear = $me->getGraduationyear() - 2; $lgyear = $me->getGraduationyear() + 2; $c = new Criteria(); $c->addJoin(UserPeer::ID, PersonalPeer::USER_ID); $c->add(UserPeer::ISLOCKED, '3'); $c->add(UserPeer::GRADUATIONYEAR, $ugyear, Criteria::GREATER_EQUAL); $c->add(UserPeer::GRADUATIONYEAR, $lgyear, Criteria::LESS_EQUAL); $c->add(UserPeer::BRANCH_ID, $me->getBranchId()); $c->add(UserPeer::AUTHCODE, sfConfig::get('app_authcode_otherauth')); $this->personaloa = PersonalPeer::doSelect($c); } if ($this->getUser()->hasCredential('masterauth')) { $c = new Criteria(); $c->addJoin(UserPeer::ID, PersonalPeer::USER_ID); $c->add(UserPeer::AUTHCODE, sfConfig::get('app_authcode_masterauth')); $c->add(UserPeer::ISLOCKED, '3'); $this->personalma = PersonalPeer::doSelect($c); } } $this->type = 'new'; $this->setTemplate('pendinglist'); }