本文整理汇总了PHP中Application_Model_User::setDefaultJournal方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_User::setDefaultJournal方法的具体用法?PHP Application_Model_User::setDefaultJournal怎么用?PHP Application_Model_User::setDefaultJournal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_User
的用法示例。
在下文中一共展示了Application_Model_User::setDefaultJournal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connectYourAccountAction
public function connectYourAccountAction()
{
//get referer sender user Id from session
$usersNs = new Zend_Session_Namespace("app");
$sender_id = $usersNs->sender_id;
//echo "sssss=".$sender_id;
$facebook = $this->view->facebook();
$session = $facebook->getSession();
//echo "<pre>";
//print_r($session);
if (!$session) {
$this->_helper->redirector("register", "index", "default");
}
$uid = $facebook->getUser();
$me = $facebook->api('/me');
//echo "<pre>";
//print_r($me);
//exit;
$params['email'] = $me['email'];
$arrBday = explode("/", $me['birthday']);
$params['year'] = $arrBday[2];
$params['month'] = $arrBday[0];
$params['day'] = $arrBday[1];
$params['firstName'] = $me['first_name'];
$params['lastName'] = $me['last_name'];
if (isset($me['gender']) && $me['gender'] != "") {
$params['sex'] = $me['gender'];
}
$form = new Application_Form_Register();
$form->populate($params);
$elements = $form->getElements();
$form->clearDecorators();
foreach ($elements as $element) {
$element->removeDecorator('label');
}
$this->view->fbmsg = $this->_getParam("fbmsg");
$this->view->form = $form;
$this->view->successMsg = "";
$this->view->sender = $this->_getParam('sender');
if ($this->getRequest()->isPost()) {
$params = $this->getRequest()->getPost();
$params['firstName'] = $me['first_name'];
$params['lastName'] = $me['last_name'];
if (isset($me['gender']) && $me['gender'] != "") {
$params['sex'] = $me['gender'];
}
if ($form->isValid($params)) {
$params['facebookId'] = $uid;
$params['dob'] = $params['year'] . "-" . $params['month'] . "-" . $params['day'];
$params['status'] = 'inactive';
$params['userLevelId'] = 1;
$password = $params['password'];
$params['password'] = md5($params['password']);
$params['status'] = "active";
/*----find gapper id ---*/
$gapper_id = 0;
if ($params['gapperOrFriend'] == "friend") {
$gapperM = new Application_Model_User();
$gapper = $gapperM->getDataByUsername($params['usernameOfGapper']);
if (false !== $gapper) {
$gapper_id = $gapper->getId();
}
}
$params['gapperId'] = $gapper_id;
/*----------------------*/
$user = new Application_Model_User($params);
$user_id = $user->save();
if ($user_id > 0) {
//If user has checked Newsletter, then insert in subscribe table
if ($params['newsletter'] == "yes") {
$user->newsletterSubscribe($user_id);
}
/*---- default permission settings ----*/
$user->setDefaultPermissions($user_id);
$user->setDefaultJournal($user_id);
/*-------------------------------------------*/
/*---------add a friend -------------*/
//$sender_id = base64_decode($this->_getParam('sender'));
//$senderM=new Application_Model_Friend();
//$senderM->addAsFriend($sender_id,$user_id);
$sender_id = $usersNs->sender_id;
if ($sender_id > 0) {
$senderM = new Application_Model_Friend();
$senderM->addAsFriend($sender_id, $user_id);
$senderM->addAsFriend($user_id, $sender_id);
}
/*-------------------------------------*/
$params['activate_link'] = Zend_Registry::get('siteurl') . "/index/activate/id/" . base64_encode($user_id);
$params['password'] = $password;
$usersNs->registration_id = $user_id;
//$mail=new Base_Mail();
//$mail->sendRegistrationMail($params);
$usersNs = new Zend_Session_Namespace("app");
$usersNs->facebookId = $uid;
$this->_helper->redirector('invite', 'index', "default");
}
}
}
}
示例2: 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;
}