Beispiel #1
0
 public static function login($email, $password)
 {
     $db = Zend_Db_Table_Abstract::getDefaultAdapter();
     $authAdapter = new Zend_Auth_Adapter_DbTable($db);
     $authAdapter->setTableName('users');
     $authAdapter->setIdentityColumn('email');
     $authAdapter->setCredentialColumn('password');
     $authAdapter->setCredentialTreatment('?');
     $authAdapter->setIdentity($email);
     $authAdapter->setCredential($password);
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate($authAdapter);
     if ($result->isValid()) {
         $data = $authAdapter->getResultRowObject(null, 'password');
         $oUser = null;
         $tUserInfo = new Table_UsersInfo();
         $data = $tUserInfo->getUser($data->userID);
         $oUser->school_id = $data->school_id;
         $oUser->user_id = $data->user_id;
         $oUser->email = $email;
         if (is_null($oUser)) {
             return false;
         }
         $auth->getStorage()->write($oUser);
         return true;
     }
     return false;
 }
Beispiel #2
0
 public function schoolTreeMenu($states, $user)
 {
     $output = "";
     $School = new Table_Schools();
     $Pop = new Table_Popularity();
     $tUser = new Table_UsersInfo();
     $class_year = $tUser->getUser($user->user_id)->class_year;
     //print_r($class_year);die;
     foreach ($states as $key => $state) {
         if ($schoollist = $School->getSchoolByState($key)) {
             $count = count($schoollist);
             $output .= "<li class='expandable'><div class='hitarea expandable-hitarea'></div>" . $state;
             $output .= "<ul  class='ulhide' style='display:none;'>";
             foreach ($schoollist as $num => $s) {
                 $popnum = $Pop->getPopularity(1, $s["school_id"], $class_year, $user->school_id);
                 if (strlen($s["name"]) > 30) {
                     $name = substr($s["name"], 0, 30) . "...";
                 } else {
                     $name = $s["name"];
                 }
                 $output .= "<li";
                 if ($count == $num + 1) {
                     $output .= " class='last' ";
                 }
                 $output .= ">\n   \t\t\t\t\t\t\t<span class='popularity'   name='" . $s["school_id"] . "'>" . $name . "(" . $popnum . ")</span>\n   \t\t  \n   \t\t\t\t\t\t\t</li>";
             }
             $output .= "\t</ul></li>";
         } else {
             $output .= "<li>" . $state . "</li>";
         }
     }
     $this->view->output = $output;
     $this->view->setScriptPath(APPLICATION_PATH . '/layouts/helpers/school-menu/');
     $sHTML = $this->view->render('school-tree-menu.phtml');
     return $sHTML;
 }
Beispiel #3
0
 public function editAction()
 {
     $form = new Forms_Profile();
     $form->submit->setLabel('Save');
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             $firstname = $form->getValue('first_name');
             $lastname = $form->getValue('last_name');
             $schoolyear = $form->getValue('school_year');
             $classyear = $form->getValue('class_year');
             $phonenumber = $form->getValue('phone_num');
             $facebook = $form->getValue('facebook');
             $linkedin = $form->getValue('linkedin');
             $twitter = $form->getValue('twitter');
             $location = $form->getValue('location');
             $status = $form->getValue('status');
             $altemail = $form->getValue('altemail');
             $summary = $form->getValue('summary');
             $interests = $form->getValue('interests');
             $favstuspot = $form->getValue('favstuspot');
             $favdrink = $form->getValue('favdrink');
             $pet = $form->getValue('pet');
             $petpeeve = $form->getValue('petpeeve');
             $data = array('first_name' => $firstname, 'last_name' => $lastname, 'school_year' => $schoolyear, 'class_year' => $classyear, 'phone_num' => $phonenumber, 'facebook' => $facebook, 'linkedin' => $linkedin, 'twitter' => $twitter, 'location' => $location, 'status' => $status, 'altemail' => $altemail, 'summary' => $summary, 'interests' => $interests, 'favstuspot' => $favstuspot, 'favdrink' => $favdrink, 'pet' => $pet, 'petpeeve' => $petpeeve);
             $tUser = new Table_UsersInfo();
             $tUser->update($data, 'user_id=' . $this->user->user_id);
             /*
             public function updateAlbum($id, $artist, $title)
             						{
             			$data = array(
             			'artist' => $artist,
             			'title' => $title,
             			);
             				$this->update($data, 'id = '. (int)$id);
             					}
             */
             $this->_helper->redirector('index');
         } else {
             $form->populate($formData);
         }
     } else {
         $tUser = new Table_UsersInfo();
         $temp = $tUser->getUser($this->user->user_id);
         $row = $temp->toArray();
         $form->populate($row);
     }
 }