示例#1
0
 public function getMenuBlockView(Student $student)
 {
     PHPWS_Core::initModClass('hms', 'RoommateProfile.php');
     $profile = RoommateProfileFactory::getProfile($student->getBannerID(), $this->term);
     PHPWS_Core::initModClass('hms', 'StudentMenuProfileView.php');
     return new StudentMenuProfileView($student, $this->getStartDate(), $this->getEndDate(), $this->term, $profile);
 }
 public function __construct(Student $student, RoomDamage $damage)
 {
     $this->banner_id = $student->getBannerId();
     $this->damage_id = $damage->getId();
     $this->state = 'new';
     $this->amount = null;
 }
示例#3
0
 /**
  * 首页
  *
  */
 public function actionIndex()
 {
     parent::_acl();
     $model = new Student();
     $criteria = new CDbCriteria();
     $criteria->condition = $condition;
     $criteria->order = 't.id ASC';
     //$criteria->with = array ( 'catalog' );
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 13;
     //$pageParams = XUtils::buildCondition( $_GET, array ( 'title' , 'catalogId','titleAlias' ) );
     //$pages->params = is_array( $pageParams ) ? $pageParams : array ();
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     //审核
     //$id = $_POST('id');
     //$status = $_POST('status');
     //$count = Student::model()->updateByPk($id, ,'status=:status',array(':status'=>$status));
     $string = '审核更新失败';
     function errorInfo($count, $string)
     {
         if ($count) {
             echo "<b>{$string}</b>";
         } else {
             echo "<b>成功</b>";
         }
     }
     set_error_handler("errorInfo");
     $this->render('student_index', array('datalist' => $result, 'pagebar' => $pages));
 }
示例#4
0
 public function executeFilter(sfWebRequest $request)
 {
     $students = Doctrine_Core::getTable('Student')->createQuery('a')->orderBy('a.created_at DESC');
     $student_uid = $request->getParameter('student_uid');
     $studentname = $request->getParameter('studentname');
     $fstudentname = $request->getParameter('fstudentname');
     $gfstudentname = $request->getParameter('fgstudentname');
     $department = $request->getParameter('department');
     // $college = $request->getParameter('college');
     if ($student_uid == 'Enter Student Id' && $studentname == 'Enter Student Name' && $fstudentname == 'Enter Father Name' && $gfstudentname == 'Enter GFather Name' && $department == '0') {
         $this->redirect('students_list');
     }
     if ($student_uid != 'Enter Student Id') {
         $students->orWhere('a.student_uid like ?', $student_uid . '%');
     }
     if ($studentname != 'Enter Student Name') {
         $students->orWhere('a.name like ?', $studentname . '%');
     }
     if ($studentname != 'Enter Father Name') {
         $students->orWhere('a.fathers_name like ?', $fstudentname . '%');
     }
     $this->pager = new sfDoctrinePager('Student', 10);
     $this->pager->setPage($request->getParameter('page', 1));
     $this->pager->init();
     $this->students = $students->execute();
     $departments = new Student();
     $this->departments = $departments->getAllDepartments();
     //$this->colleges = $departments->getAllColleges();
 }
 /**
  * Authenticates a dummy user.
  * @return boolean always true.
  */
 public function authenticate()
 {
     $student = Student::model()->findByAttributes(array('username' => $this->username));
     if ($student === null) {
         $student = new Student();
         $faculty = Faculty::model()->findByPk(1);
         if ($faculty === null) {
             $faculty = new Faculty();
             $faculty->id = 1;
             $faculty->name = 'Dummy Faculty';
             $faculty->save(false);
         }
         $student->username = $this->username;
         $student->name = $this->name;
         $student->is_admin = $this->isAdmin;
         $student->faculty_id = $faculty->id;
         $student->photo = Yii::app()->params['defaultProfilePhoto'];
     }
     $student->last_login_timestamp = date('Y-m-d H:i:s');
     $student->save();
     $this->id = $student->id;
     $this->name = $student->name;
     $this->setState('isAdmin', $student->is_admin);
     $this->setState('profilePhoto', $student->photo);
     return true;
 }
示例#6
0
 public function getMenuBlockView(Student $student)
 {
     PHPWS_Core::initModClass('hms', 'HousingApplication.php');
     PHPWS_Core::initModClass('hms', 'ApplicationMenuBlockView.php');
     $application = HousingApplication::getApplicationByUser($student->getUsername(), $this->term);
     return new ApplicationMenuBlockView($this->term, $this->getStartDate(), $this->getEditDate(), $this->getEndDate(), $application);
 }
function cont_nou()
{
    set('recaptcha', recaptcha_get_html(Config::get_key('recaptcha_pubkey')));
    $s = $_POST['s'];
    option('session', true);
    $_SESSION['s'] = $s;
    $s['cnp'] = filter_var($s['cnp'], FILTER_SANITIZE_NUMBER_INT);
    $s['cont'] = filter_var($s['cont'], FILTER_SANITIZE_STRING);
    $s['parola'] = filter_var($s['parola'], FILTER_SANITIZE_STRING);
    $s['alias'] = filter_var($s['alias'], FILTER_SANITIZE_STRING);
    $resp = recaptcha_check_answer(Config::get_key('recaptcha_privkey'), $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
    if (!$resp->is_valid) {
        flash('fail', 'Contul nu a fost creat. Verificați testul anti-robot.');
    } else {
        if (!empty($s['cnp']) && !empty($s['cont']) && !empty($s['parola'])) {
            $cont = new Student();
            $u = $cont->valid_user($s['cont'], $s['parola'], $s['cnp'], $s['alias']);
            if ($u) {
                if ($cont->create_user($u)) {
                    flash('ok', 'Contul a fost creat. Mulțumim.');
                } else {
                    flash('fail', 'Contul nu a fost creat. A intervenit o eroare.');
                }
            } else {
                flash('fail', 'Contul nu a fost creat. Utilizatorul sau alias-ul există deja sau avem o problemă cu SINU.');
            }
        } else {
            flash('fail', 'Contul nu a fost creat. Verificați câmpurile obligatorii.');
        }
    }
    redirect_to('creare');
}
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     $names = array('Martin', 'Pedro', 'Lucas', 'Agustin', 'Cristian', 'Matias', 'Tomas', 'Cludio', 'Nancy', 'Emilia', 'Alejandra', 'Barbara', 'Luciana', 'Lucia', 'Belen', 'Natalia', 'Adriana', 'Patricio', 'Diego', 'Gonzalo', 'Juan', 'Pablo');
     $last_names = array('Ramirez', 'Rodriguez', 'Cordoba', 'Brown', 'Osorio', 'Diaz', 'Ayesa', 'Ramirez', 'Perez', 'Ripoll', 'Bottini', 'Ponce', 'Casella', 'Martinez', 'Erviti', 'Rodgriguez', 'Gonzalez', 'Fernandez', 'Benitez');
     $this->createContextInstance('backend');
     for ($i = 1; $i <= 100; $i++) {
         $person = new Person();
         $person->setLastname($last_names[rand(0, 18)]);
         $person->setFirstName($names[rand(0, 21)]);
         $person->setIdentificationType(1);
         $person->setIdentificationNumber($i);
         $person->setSex(rand(1, 2));
         $person->setBirthDate('2000-06-30');
         $student = new Student();
         $student->setGlobalFileNumber($i);
         $student->setPerson($person);
         $person->save();
         $student->save();
         $this->logSection("Person created", $person->__toString());
     }
     // add your code here
 }
示例#9
0
 function testPaidForDocument()
 {
     $x = new Student(1);
     $this->assertTrue($x->paid_for_document(1));
     $this->assertFalse($x->paid_for_document(3));
     $this->assertFalse($x->paid_for_document(999));
     $this->assertFalse($x->paid_for_document('dog'));
 }
示例#10
0
 protected function getAsObject($row)
 {
     $result = new Student();
     $result->setNew(false);
     $result->setStudentId(Singleton::create("NullConverter")->fromDBtoDOM($row["studentId"]));
     $result->setName(Singleton::create("NullConverter")->fromDBtoDOM($row["name"]));
     return $result;
 }
示例#11
0
 public function __construct(Student $student1, Student $student2, $lifestyle, $earliestTime)
 {
     $this->student1 = $student1;
     $this->student2 = $student2;
     $this->lifestyle = $lifestyle;
     $this->gender = $student1->getGender();
     $this->earliestTime = $earliestTime;
 }
示例#12
0
 public static function retrieveCurrentForStudentCriteria(Student $student, Criteria $c = null)
 {
     $c = is_null($c) ? new Criteria() : $c;
     $c->add(self::SCHOOL_YEAR_ID, SchoolYearPeer::retrieveCurrent()->getId());
     $c->addJoin(self::ID, StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID);
     $c->add(StudentCareerSchoolYearPeer::STUDENT_ID, $student->getId());
     return $c;
 }
示例#13
0
 public function select_group()
 {
     $group_id = $this->input->post('group_id');
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $group = new Group();
     $group->get_by_id($group_id);
     if ($group->exists()) {
         $course = $group->course->get();
         if (is_null($course->groups_change_deadline) || date('U', strtotime($course->groups_change_deadline)) >= time()) {
             $student = new Student();
             $student->get_by_id($this->usermanager->get_student_id());
             if ($student->is_related_to('active_course', $course->id)) {
                 $participant = new Participant();
                 $participant->where_related($student);
                 $participant->where_related($course);
                 $participant->where('allowed', 1);
                 $participant->get();
                 if ($participant->exists()) {
                     if (!$participant->is_related_to($group)) {
                         $participant->save($group);
                         $participant->where_related($course);
                         $participant->where_related($group);
                         $participant->where('allowed', 1);
                         $participants_count = $participant->count();
                         $room = new Room();
                         $room->where_related($group)->order_by('capacity', 'asc')->limit(1)->get();
                         if ($participants_count > intval($room->capacity)) {
                             $this->db->trans_rollback();
                             $this->messages->add_message('lang:groups_message_group_is_full', Messages::MESSAGE_TYPE_ERROR);
                         } else {
                             $this->db->trans_commit();
                             $this->messages->add_message(sprintf($this->lang->line('groups_message_group_changed'), $this->lang->text($group->name)), Messages::MESSAGE_TYPE_SUCCESS);
                             $this->_action_success();
                             $this->output->set_internal_value('course_id', $participant->course_id);
                         }
                     } else {
                         $this->db->trans_rollback();
                         $this->messages->add_message('lang:groups_message_you_are_in_group', Messages::MESSAGE_TYPE_ERROR);
                     }
                 } else {
                     $this->db->trans_rollback();
                     $this->messages->add_message('lang:groups_message_cant_found_participant_record', Messages::MESSAGE_TYPE_ERROR);
                 }
             } else {
                 $this->db->trans_rollback();
                 $this->messages->add_message('lang:groups_message_cant_change_group_of_inactive_course', Messages::MESSAGE_TYPE_ERROR);
             }
         } else {
             $this->db->trans_rollback();
             $this->messages->add_message('lang:groups_message_groups_switching_disabled', Messages::MESSAGE_TYPE_ERROR);
         }
     } else {
         $this->db->trans_rollback();
         $this->messages->add_message('lang:groups_message_group_not_found', Messages::MESSAGE_TYPE_ERROR);
     }
     redirect(create_internal_url('groups'));
 }
 public static function getInstance(Student $a_student)
 {
     if (isset(self::$analyticals[$a_student->getId()])) {
         return self::$analyticals[$a_student->getId()];
     }
     $behavior = ucwords(sfConfig::get("nc_flavor_flavors_current", "demo"));
     $clazz = $behavior . "AnalyticalBehaviour";
     return self::$analyticals[$a_student->getId()] = new $clazz($a_student);
 }
 /**
  * Create a new RoomChangeParticipant
  *
  * @param RoomChangeRequest $request
  * @param Student $student
  * @param HMS_Bed $fromBed
  */
 public function __construct(RoomChangeRequest $request, Student $student, HMS_Bed $fromBed)
 {
     $this->id = 0;
     $this->request_id = $request->getId();
     $this->banner_id = $student->getBannerId();
     $this->from_bed = $fromBed->getId();
     // Set initial state
     $this->setState(new ParticipantStateNew($this, time(), null, UserStatus::getUsername()));
 }
示例#16
0
 public static function getMembership(Student $student, $term)
 {
     $db = PdoFactory::getPdoInstance();
     $query = "select hms_learning_community_assignment.* from hms_learning_community_assignment JOIN hms_learning_community_applications ON hms_learning_community_assignment.application_id = hms_learning_community_applications.id where term = :term and username = :username;";
     $stmt = $db->prepare($query);
     $stmt->execute(array('username' => $student->getUsername(), 'term' => $term));
     $stmt->setFetchMode(PDO::FETCH_CLASS, 'RlcMembershipRestored');
     return $stmt->fetch();
 }
示例#17
0
 public function getMenuBlockView(Student $student)
 {
     PHPWS_Core::initModClass('hms', 'RoomChangeMenuBlockView.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'RoomChangeRequestFactory.php');
     $assignment = HMS_Assignment::getAssignment($student->getUsername(), $this->term);
     $request = RoomChangeRequestFactory::getPendingByStudent($student, $this->term);
     return new RoomChangeMenuBlockView($student, $this->term, $this->getStartDate(), $this->getEndDate(), $assignment, $request);
 }
示例#18
0
 public function actionAdmin()
 {
     $model = new Student('search');
     $model->unsetAttributes();
     if (isset($_GET['Student'])) {
         $model->setAttributes($_GET['Student']);
     }
     $this->render('admin', array('model' => $model));
 }
示例#19
0
 public function contains(Student $student)
 {
     foreach ($this->students as $s) {
         if ($s->getId() == $student->getId()) {
             return true;
         }
     }
     return false;
 }
示例#20
0
 public function render()
 {
     if (isset($this->config['course_id'])) {
         $course = new Course();
         $course->include_related('period');
         $course->get_by_id((int) $this->config['course_id']);
         $this->parser->assign('course', $course);
         if ($course->exists()) {
             $task_sets = new Task_set();
             $task_sets->where_related($course);
             $task_sets->where('published', 1);
             $task_sets->where('content_type', 'task_set');
             $task_sets_count = $task_sets->count();
             $this->parser->assign('task_sets_count', $task_sets_count);
             $task_sets->where_related($course);
             $task_sets->where('published', 1);
             $task_sets->where('content_type', 'project');
             $projects_count = $task_sets->count();
             $this->parser->assign('projects_count', $projects_count);
             $groups = new Group();
             $groups->where_related($course);
             $groups_count = $groups->count();
             $this->parser->assign('groups_count', $groups_count);
             $students = new Student();
             $students->where_related('participant/course', 'id', $course->id);
             $students->where_related('participant', 'allowed', 1);
             $students_count = $students->count();
             $this->parser->assign('students_count', $students_count);
             $task_set_permissions = new Task_set_permission();
             $task_set_permissions->select_func('COUNT', '*', 'count');
             $task_set_permissions->where('enabled', 1);
             $task_set_permissions->where_related('task_set', 'id', '${parent}.id');
             $now = date('Y-m-d H:i:s');
             $plus_two_weeks = date('Y-m-d H:i:s', strtotime($now . ' + 2 weeks'));
             $minus_one_week = date('Y-m-d H:i:s', strtotime($now . ' - 1 week'));
             $task_sets->select('id, name, upload_end_time AS min_upload_end_time, upload_end_time AS max_upload_end_time');
             $task_sets->where_related($course);
             $task_sets->where('published', 1);
             $task_sets->where_subquery('0', $task_set_permissions);
             $task_sets->where('upload_end_time >=', $minus_one_week);
             $task_sets->where('upload_end_time <=', $plus_two_weeks);
             $task_sets_2 = new Task_set();
             $task_sets_2->select('id, name');
             $task_sets_2->where_related($course);
             $task_sets_2->where('published', 1);
             $task_sets_2->select_min('task_set_permissions.upload_end_time', 'min_upload_end_time');
             $task_sets_2->select_max('task_set_permissions.upload_end_time', 'max_upload_end_time');
             $task_sets_2->where_related('task_set_permission', 'enabled', 1);
             $task_sets_2->having('(MAX(`task_set_permissions`.`upload_end_time`) >= ' . $this->db->escape($minus_one_week) . ' AND MAX(`task_set_permissions`.`upload_end_time`) <= ' . $this->db->escape($plus_two_weeks) . ')');
             $task_sets_2->or_having('(MIN(`task_set_permissions`.`upload_end_time`) >= ' . $this->db->escape($minus_one_week) . ' AND MIN(`task_set_permissions`.`upload_end_time`) <= ' . $this->db->escape($plus_two_weeks) . ')');
             $task_sets_2->group_by('id');
             $task_sets->union_iterated($task_sets_2, FALSE, 'min_upload_end_time DESC, max_upload_end_time DESC', isset($this->config['number_of_task_sets']) ? (int) $this->config['number_of_task_sets'] : 5);
             $this->parser->assign('task_sets', $task_sets);
         }
     }
     $this->parser->parse('widgets/admin/course_overview/main.tpl');
 }
 public static function getApplication(Student $student, $term)
 {
     $db = PdoFactory::getPdoInstance();
     $query = "SELECT * FROM hms_learning_community_applications where username = :username and term = :term";
     $stmt = $db->prepare($query);
     $stmt->execute(array('username' => $student->getUsername(), 'term' => $term));
     $stmt->setFetchMode(PDO::FETCH_CLASS, 'RlcApplicationRestored');
     return $stmt->fetch();
 }
 public static function getParticipantByRequestStudent(RoomChangeRequest $request, Student $student)
 {
     $db = PdoFactory::getPdoInstance();
     $query = "SELECT * FROM hms_room_change_curr_participant WHERE request_id = :request_id and banner_id = :bannerId";
     $stmt = $db->prepare($query);
     $params = array('request_id' => $request->getId(), 'bannerId' => $student->getBannerId());
     $stmt->execute($params);
     $stmt->setFetchMode(PDO::FETCH_CLASS, 'RoomChangeParticipantRestored');
     return $stmt->fetch();
 }
 public function save($data)
 {
     $student = new Student();
     $student->first_name = $data['first_name'];
     $student->last_name = $data['last_name'];
     $student->dob = $data['dob'];
     $student->irs_number = $data['irs_number'];
     $student->save();
     return $student;
 }
 function testForStudent()
 {
     $x = new Student(1);
     $y = $x->consultation_requests();
     $this->assertType('array', $y);
     $this->assertEquals(2, count($y));
     $z = array_shift($y);
     $this->assertType('ConsultationRequest', $z);
     $this->assertEquals(3, $z->id);
 }
 function view($id)
 {
     $model = new Student();
     $act = new Activities_student();
     $student = $model->select($id);
     $act->where("id", $id);
     $activity = $act->query("SELECT point from activitys\n                                 LEFT JOIN activities_students ON activitys.id = activities_students.activity_id\n                                 WHERE student_id = {$id}");
     $this->set('student', $student);
     $this->set('info', $activity);
 }
示例#26
0
 public static function getContractByStudentTerm(Student $student, $term)
 {
     PHPWS_Core::initModClass('hms', 'Contract.php');
     $db = PdoFactory::getPdoInstance();
     $query = 'SELECT * FROM hms_contract WHERE banner_id = :bannerId AND term = :term';
     $stmt = $db->prepare($query);
     $params = array('bannerId' => $student->getBannerId(), 'term' => $term);
     $stmt->execute($params);
     $stmt->setFetchMode(PDO::FETCH_CLASS, 'ContractRestored');
     return $stmt->fetch();
 }
示例#27
0
 public function __construct(Student $student, HMS_Bed $bed, $term, $checkinBy, $keyCode)
 {
     $this->setBannerId($student->getBannerId());
     $this->setBedPersistentId($bed->getPersistentId());
     $this->setBedId($bed->getId());
     $this->setTerm($term);
     $this->setRoomId($bed->get_parent()->getId());
     $this->setCheckinDate(time());
     $this->setCheckinby($checkinBy);
     $this->setKeyCode($keyCode);
 }
示例#28
0
 public function getMenuBlockView(Student $student)
 {
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'RlcSelfSelectionMenuBlockView.php');
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     $rlcAssignment = HMS_RLC_Assignment::getAssignmentByUsername($student->getUsername(), $this->getTerm());
     $roomAssignment = HMS_Assignment::getAssignmentByBannerId($student->getBannerId(), $this->getTerm());
     $roommateRequests = HMS_Lottery::get_lottery_roommate_invites($student->getUsername(), $this->term);
     return new RlcSelfSelectionMenuBlockView($this->term, $this->getStartDate(), $this->getEndDate(), $rlcAssignment, $roomAssignment, $roommateRequests);
 }
示例#29
0
 public function getMenuBlockView(Student $student)
 {
     // Get an application if one exists
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
     $application = HMS_RLC_Application::getApplicationByUsername($student->getUsername(), $this->getTerm());
     // Check for an assignment
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     $assignment = HMS_RLC_Assignment::getAssignmentByUsername($student->getUsername(), $this->getTerm());
     PHPWS_Core::initModClass('hms', 'RlcApplicationMenuView.php');
     return new RlcApplicationMenuView($this->term, $student, $this->getStartDate(), $this->getEditDate(), $this->getEndDate(), $application, $assignment);
 }
示例#30
0
 public function insert()
 {
     if (!$this->title) {
         return "Inserire il titolo dell'avviso";
     }
     if (!$this->text) {
         return "Inserire il testo dell'avviso";
     }
     if (!is_array($this->id_dest)) {
         return "Selezionare almeno un destinatario";
     }
     $tabella = "avvisi";
     $campi = array("titolo", "testo", "id_studente", "invio_mail");
     $valori = array($this->title, $this->text, implode(";", $this->id_dest), $this->mail_send);
     $auth = $this->connector->insert($tabella, $campi, $valori);
     if (mysql_errno() == 1062) {
         return "Avviso già presente";
     } else {
         if (mysql_errno() > 0) {
             return "Errore interno numero: " . mysql_errno();
         }
     }
     if ($this->mail_send) {
         $student = new Student();
         $student->setConnector($this->connector);
         $lista = array();
         if (in_array(0, $this->id_dest)) {
             $lista = $student->getList();
         } else {
             foreach ($this->id_dest as $id_dest) {
                 $tmp_stud = $student->getById($id_dest);
                 $lista[] = $tmp_stud;
             }
         }
         $errore = "";
         foreach ($lista as $student) {
             $student->setConnector($this->connector);
             $destinatario = $student->email;
             $mittente_mail = "";
             $oggetto = "";
             $messaggio = "";
             $intestazioni = "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nFrom: {$mittente_mail}";
             //invio la mail
             $risultato = mail($destinatario, $oggetto, $messaggio, $intestazioni);
             //reindirizzamento
             if (!$risultato) {
                 $errore .= "Problema nell'inoltro dell'email all'indirizzo {$destinatario}. L'avviso è stato comunque registrato sul portale<br>";
             }
         }
         if ($errore != "") {
             return $errore;
         }
     }
 }