本文整理汇总了PHP中Application_Model_User::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_User::setId方法的具体用法?PHP Application_Model_User::setId怎么用?PHP Application_Model_User::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_User
的用法示例。
在下文中一共展示了Application_Model_User::setId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchAll
public function fetchAll()
{
$resultSet = $this->getDbTable()->fetchAll();
$entries = array();
foreach ($resultSet as $row) {
$entry = new Application_Model_User();
$entry->setId($row->id)->setPassword($row->password)->setUserName($row->username);
$entries[] = $entry;
}
return $entries;
}
示例2: setModel
private function setModel($row)
{
$model = new Application_Model_User();
$model->setId($row->id)->setEmail($row->email)->setUsername($row->username)->setPassword($row->password)->setFirstName($row->first_name)->setLastName($row->last_name)->setImage($row->image)->setDob($row->dob)->setSex($row->sex)->setCityId($row->city_id)->setCountryPassport($row->country_passport)->setPreferredLanguage($row->preferred_language)->setOtherLanguages($row->other_languages)->setGapperOrFriend($row->gapper_or_friend)->setGapperId($row->gapper_id)->setFirstTimeTraveller($row->first_time_traveller)->setMobileCountryCode($row->mobile_country_code)->setMobile($row->mobile)->setStatus($row->status)->setDreamDestination($row->dream_destination)->setWayToTravel($row->way_to_travel)->setTravelGear($row->travel_gear)->setYearGoal($row->year_goal)->setLeaveHomeWithout($row->leave_home_without)->setInterests($row->interests)->setEvenTakenGapYear($row->even_taken_gap_year)->setNextTravelToDoList($row->next_travel_to_do_list)->setFavouriteTravelExperience($row->favourite_travel_experience)->setNewsletter($row->newsletter)->setFacebookId($row->facebook_id)->setAddedon($row->addedon)->setUpdatedon($row->updatedon)->setUserLevelId($row->user_level_id);
return $model;
}
示例3: toModel
public function toModel($row)
{
$user = new Application_Model_User();
$user->setId($row->id)->setEmail_user($row->email_user)->setNom_user($row->nom_user)->setPrenom_user($row->prenom_user)->setAdresse_1_user($row->adresse_1_user)->setAdresse_2_user($row->adresse_2_user)->setZip_user($row->zip_user)->setPassword_user($row->password_user)->setNb_max_emprunt_user($row->nb_max_emprunt_user)->setDelais_emprunt_user($row->delais_max_emprunt_user)->setService_user($row->service_user)->setDate_inscription($row->date_inscription)->setBureau_user($row->bureau_user)->setParution_id_parution($row->parution_id_parution)->setActif_user($row->actif_user)->setValid_mail_user($row->valid_mail_user)->setActivation_user($row->activation_user);
return $user;
}
示例4: setModel
public function setModel($row)
{
$model = new Application_Model_User();
$model->setId($row->id)->setEmail($row->email)->setUsername($row->username)->setPassword($row->password)->setFirstName($row->first_name)->setMiddleName($row->middle_name)->setLastName($row->last_name)->setDob($row->dob)->setSex($row->sex)->setProfilePicture($row->profile_picture)->setMobile($row->mobile)->setStatus($row->status)->setDoj($row->doj)->setMarriageAnniversary($row->marriage_anniversary)->setFatherName($row->father_name)->setDesignationId($row->designation_id)->setDepartmentId($row->department_id)->setCorrespondenceAddress($row->correspondence_address)->setPan($row->pan)->setContactNo($row->contact_no)->setExtensionNo($row->extension_no)->setSkype($row->skype)->setEmployeeCode($row->employee_code)->setAddedon($row->addedon)->setUpdatedon($row->updatedon)->setUserLevelId($row->user_level_id);
if ($designation = $row->findParentRow("Application_Model_DbTable_Designation")) {
$model->setDesignation($designation->title);
} else {
$model->setDesignation("N/A");
}
if ($department = $row->findParentRow("Application_Model_DbTable_Department")) {
$model->setDepartment($department->title);
} else {
$model->setDepartment("N/A");
}
return $model;
}
示例5: addAction
public function addAction()
{
$request = $this->getRequest();
$form = new Admin_Form_User();
$options = $request->getPost();
if ($request->isPost()) {
/*---- email validation ----*/
$form->getElement('email')->addValidators(array(array('Db_NoRecordExists', false, array('table' => 'user', 'field' => 'email', 'messages' => 'Email already exists, Please choose another email address.'))));
/*-------------------------*/
if ($form->isValid($options)) {
$model = new Application_Model_User();
$options['dob'] = $options['year'] . "-" . $options['month'] . "-" . $options['day'];
$options['status'] = 'active';
$options['password'] = md5($options['password']);
$options['preferredLanguage'] = 'English';
//$options['userLevelId'] =$options['userLevelId'];
//$model->setOptions($options);
// $id=$model->save();
/*--------- Upload image START -------------------------*/
$upload = new Zend_File_Transfer_Adapter_Http();
if ($upload->isValid('image')) {
$upload->setDestination("media/picture/profile/");
try {
$upload->receive('image');
} catch (Zend_File_Transfer_Exception $e) {
$msg = $e->getMessage();
}
$upload->setOptions(array('useByteString' => false));
$file_name = $upload->getFileName('image');
$cardImageTypeArr = explode(".", $file_name);
$ext = strtolower($cardImageTypeArr[count($cardImageTypeArr) - 1]);
$target_file_name = "profile_" . $id . ".{$ext}";
$targetPath = 'media/picture/profile/' . $target_file_name;
$filterFileRename = new Zend_Filter_File_Rename(array('target' => $targetPath, 'overwrite' => true));
$filterFileRename->filter($file_name);
$options['image'] = $target_file_name;
/*--- Generate Thumbnail ---*/
$thumb = Base_Image_PhpThumbFactory::create($targetPath);
$thumb->resize(100, 100);
$thumb->save($targetPath = 'media/picture/profile/thumb_' . $target_file_name);
$model->setOptions($options);
$model->setId($id);
$id = $model->save();
}
/*--------- Upload image END -------------------------*/
//$options['dob'] = $options['year']."-".$options['month']."-".$options['day'];
//$model->setOptions($options);
//$model->save();
$user = new Application_Model_User($options);
$user_id = $user->save();
if ($user_id > 0) {
/*---- default permission settings ----*/
$user->setDefaultPermissions($user_id);
$user->setDefaultJournal($user_id);
}
$this->view->msg = "'User has been inserted successfully!";
$form->reset();
} else {
$form->reset();
$form->populate($options);
}
}
$this->view->form = $form;
}
示例6: editAction
public function editAction()
{
if (!Zend_Auth::getInstance()->hasIdentity()) {
return $this->_redirect('/');
}
$user = new Zend_Session_Namespace('user');
// process the form
$form = new Application_Form_UserEdit();
if ($this->getRequest()->isPost()) {
if ($form->isValid($_POST)) {
/**
* Because some fields are excluded from the form, they will be
* set manually
*/
$id = $user->user['id'];
$username = $user->user['username'];
$password_salt = $user->user['password_salt'];
$password_hash = $user->user['password_hash'];
if ($form->getValue('password') == $form->getValue('password_confirm')) {
/**
* Check if the user changed the email to one that is
* already in use
*/
$user_mapper = new Application_Model_UserMapper();
$email = $user_mapper->findByEmail($form->getValue('email'));
$duplicate = false;
if ($email) {
$email = $email[0];
if ($id != $email->getId()) {
$duplicate = true;
}
}
if (!$duplicate) {
// update the user
$values = $form->getValues();
$user_mapper = new Application_Model_UserMapper();
$user = new Application_Model_User($values);
$user->setId($id);
$user->setUsername($username);
$user->setPassword_salt($password_salt);
$user->setPassword_hash($password_hash);
$user->setActive(1);
$user_mapper->save($user);
// update the session
$session = new Zend_Session_Namespace('user');
$session->user = $user->get_array();
$this->_helper->FlashMessenger('Successful Update');
return $this->_redirect('/user');
} else {
print "A user with this email already exists.";
}
} else {
print "The password was not confirmed.";
}
} else {
print 'Invalid form';
}
}
// populate the form with the user's information
$elements = $form->getElements();
unset($elements['submit']);
foreach ($elements as $key => $row) {
$form->{$key}->setValue($user->user[$key]);
}
$this->view->form = $form;
}