本文整理汇总了PHP中Member::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::save方法的具体用法?PHP Member::save怎么用?PHP Member::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$count = (int) $arguments['count'];
for ($i = 0; $i < $count; ++$i) {
$m = new Member();
$m->is_active = 1;
$m->save();
$name = "DO民ID:" . $m->id;
$m->name = $name;
$m->save();
}
}
示例2: execute
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$n = (int)$options['number'];
$link = $options['link'];
if (!is_null($link))
{
$linkMember = Doctrine::getTable('Member')->find($link);
if (!$linkMember)
{
throw new Exception("not found member: ".$link);
}
}
for ($i = 0; $i < $n; $i++)
{
$member = new Member();
$member->setName('dummy');
$member->setIsActive(self::fetchRandomNotActive($options['notactivemember-rate'], $n));
$member->save();
$member->setName(sprintf($options['name-format'], $member->getId()));
$member->save();
$address = sprintf($options['mail-address-format'], $member->getId());
$member->setConfig('pc_address', $address);
$member->setConfig('mobile_address', $address);
$password = preg_replace("/%d/", $member->getId(), $options['password-format'], 1);
$member->setConfig('password', md5($password));
$this->logSection('member+', $member->getName());
if (isset($linkMember))
{
$memberRelationship1 = new MemberRelationship();
$memberRelationship1->setMember($member);
$memberRelationship1->setMemberRelatedByMemberIdFrom($linkMember);
$memberRelationship1->setIsFriend(true);
$memberRelationship1->save();
$memberRelationship2 = new MemberRelationship();
$memberRelationship2->setMember($linkMember);
$memberRelationship2->setMemberRelatedByMemberIdFrom($member);
$memberRelationship2->setIsFriend(true);
$memberRelationship2->save();
$this->logSection('friend link', sprintf("%s - %s", $linkMember->getId(), $member->getId()));
}
}
}
示例3: create_post
public function create_post()
{
$this->layout = '';
$rules = array('first_name' => 'required', 'last_name' => 'required', 'email' => 'email|unique:members,email', 'photo' => 'mimes:jpeg,bmp,png|max:200', 'dob' => 'date_format:Y-m-d');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('members/create')->withInput()->withErrors($validator);
} else {
$filename = '';
if (Input::hasFile('photo')) {
$file = Input::file('photo');
$filename = Input::file('photo')->getClientOriginalName();
$extension = substr(strrchr($filename, '.'), 1);
$newname = strtolower(md5(date("Y-m-d") . Input::get('username')) . '.' . $extension);
$uploadStatus = Input::file('photo')->move(Config::get('app.upload_path'), $newname);
if ($uploadStatus) {
$filename = $newname;
}
}
$member = new Member();
$member->number = date("YmdHis");
$member->first_name = Input::get('first_name');
$member->last_name = Input::get('last_name');
$member->address = Input::get('address');
$member->phone = Input::get('phone');
$member->dob = Input::get('dob');
$member->email = Input::get('email');
$member->photo = $filename;
$member->save();
return Redirect::to('members/create')->with('success', 'Member has been created.');
}
}
示例4: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$user = new User();
$member = new Member();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['User'], $_POST['Member'])) {
$user->attributes = $_POST['User'];
$user->repeat_password = $_POST['User']['repeat_password'];
$member->attributes = $_POST['Member'];
$member->type_account = $_POST['Member']['type_account'];
$user->scenario = 'register';
$member->scenario = 'register';
$user->level = 3;
$valid = $user->validate();
$valid = $member->validate() && $valid;
if ($valid) {
$email = explode("@", $user->username);
$member->name = $email[0];
$member->email = $user->username;
$member->date_register = new CDbExpression('NOW()');
$member->code = strtoupper(substr(md5(uniqid(rand(), true)), 0, 5));
$getToken = rand(0, 99999);
$getTime = date("H:i:s");
$user->token = md5($getToken . $getTime);
$user->save();
$member->save();
MemberController::SendMail($member->email, $member->name, $member->code, $user->token);
echo CJSON::encode(array('reg' => 'success', 'redirect' => $this->createUrl(array('land/userme')), 'email' => $member->email));
} else {
echo CJSON::encode(array('reg' => 'failed', 'email' => str_replace('Username', 'Email', CHtml::error($user, 'username')), 'username' => str_replace('Name', 'Username', CHtml::error($member, 'name')), 'password' => CHtml::error($user, 'password'), 'repeat_password' => CHtml::error($user, 'repeat_password'), 'all' => Chtml::errorSummary(array($user, $member))));
}
}
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @return Responsef81a482d8069a749bd141a2efa68de7d
*/
public function store()
{
$validator = Validator::make(Input::all(), Member::$rules);
var_dump(Input::all());
// process the login
if ($validator->fails()) {
return Redirect::to('members/create')->withErrors($validator)->withInput(Input::except('password'));
} else {
if (User::check_username(Input::get("username")) && User::check_email(Input::get("email"))) {
$member = new Member();
$member->username = Input::get('username');
$member->password = md5(sha1(Input::get("password")));
$member->name = Input::get('name');
$member->email = Input::get('email');
$member->status = 1;
$member->save();
//log
Logfile::addData('thêm', 'thành viên', $member->id, $member->name);
User::find($member->id)->roles()->attach(1);
// redirect
Session::flash('message', 'Thêm thanh vien mới thành công!');
return Redirect::to('members');
} else {
Session::flash('message', 'ten dang nhap hoac email da ton tai');
return Redirect::to('members/create')->with('error', 'ten dang nhap hoac email da ton tai')->withInput();
}
}
}
示例6: createPre
public function createPre()
{
$member = new Member();
$member->setIsActive(false);
$member->save();
return $member;
}
示例7: createOrg
public static function createOrg($opts)
{
$organization = \Organization::saveRecord(null, array("name" => $opts['user']->name));
$centre = new \Centre(array("user_id" => $opts['user']->id, "organization_id" => $organization->id, "type" => "clinic", "department" => json_encode(RequestMethods::post("department", array("Clinic"))), "phone" => RequestMethods::post("org_phone", ""), "location_id" => $opts['location']->id));
$centre->save();
$member = new \Member(array("user_id" => $opts['user']->id, "centre_id" => $centre->id, "organization_id" => $organization->id, "designation" => "admin", "image" => "", "live" => 1));
$member->save();
return $organization;
}
示例8: activity_createBonusTransaction
public static function activity_createBonusTransaction(Member $login, Member $recipient, array $data, PropelPDO $con)
{
$currentTransfer = $recipient->getCurrentTransferBundle(self::$BASE_CURRENCY, $con);
$when = time();
$amount = $data['amount'];
$recipient->addOutstandingTotal($amount, self::$BASE_CURRENCY);
$transaction = $currentTransfer->addAmount($amount)->setReason(Transaction::REASON_CUSTOM_BONUS)->setPurpose($data['purpose'])->setRelatedId($login->getId())->setDate($when)->save($con);
$currentTransfer->save($con);
$recipient->save($con);
}
示例9: createMember
public static function createMember(\Member $referralMember = null, array $data = array())
{
$member = new \Member();
$member->fromArray(array_merge(self::$memberDefaults, $data));
if ($referralMember) {
$member->setRefererMember($referralMember, self::$con);
}
$member->save(self::$con);
return $member;
}
示例10: executeTransaction
protected function executeTransaction($conn, $arguments = array(), $options = array())
{
$n = (int) $options['number'];
$link = $options['link'];
if (null !== $link) {
$linkMember = Doctrine::getTable('Member')->find($link);
if (!$linkMember) {
throw new Exception("not found member: " . $link);
}
}
for ($i = 0; $i < $n; $i++) {
$member = new Member();
$member->setName('dummy');
$member->setIsActive(true);
$member->save();
$member->setName(sprintf($options['name-format'], $member->getId()));
$member->save();
$address = sprintf($options['mail-address-format'], $member->getId());
self::setMemberConfig($member->id, 'pc_address', $address);
self::setMemberConfig($member->id, 'mobile_address', $address);
$password = preg_replace("/%d/", $member->getId(), $options['password-format'], 1);
self::setMemberConfig($member->id, 'password', md5($password));
$this->logSection('member+', $member->getName());
if (isset($linkMember)) {
$memberRelationship1 = new MemberRelationship();
$memberRelationship1->setMemberIdTo($member->id);
$memberRelationship1->setMemberIdFrom($linkMember->id);
$memberRelationship1->setIsFriend(true);
$memberRelationship1->save();
$memberRelationship1->free(true);
$memberRelationship2 = new MemberRelationship();
$memberRelationship2->setMemberIdTo($linkMember->id);
$memberRelationship2->setMemberIdFrom($member->id);
$memberRelationship2->setIsFriend(true);
$memberRelationship2->save();
$memberRelationship2->free(true);
$this->logSection('friend link', sprintf("%s - %s", $linkMember->getId(), $member->getId()));
}
$member->free(true);
}
}
示例11: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aMember !== null) {
if ($this->aMember->isModified() || $this->aMember->isNew()) {
$affectedRows += $this->aMember->save($con);
}
$this->setMember($this->aMember);
}
if ($this->aAircraft !== null) {
if ($this->aAircraft->isModified() || $this->aAircraft->isNew()) {
$affectedRows += $this->aAircraft->save($con);
}
$this->setAircraft($this->aAircraft);
}
if ($this->isNew()) {
$this->modifiedColumns[] = PilotAircraftPeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = PilotAircraftPeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setId($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += PilotAircraftPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collMissionLegs !== null) {
foreach ($this->collMissionLegs as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例12: store
/**
* Store a newly created member in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Member::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$member = new Member();
if (Input::get('branch_id') != null) {
$branch = Branch::findOrFail(Input::get('branch_id'));
$member->branch()->associate($branch);
}
if (Input::get('group_id') != null) {
$group = Group::findOrFail(Input::get('group_id'));
$member->group()->associate($group);
}
if (Input::hasFile('photo')) {
$destination = public_path() . '/uploads/photos';
$filename = str_random(12);
$ext = Input::file('photo')->getClientOriginalExtension();
$photo = $filename . '.' . $ext;
Input::file('photo')->move($destination, $photo);
$member->photo = $photo;
}
if (Input::hasFile('signature')) {
$destination = public_path() . '/uploads/photos';
$filename = str_random(12);
$ext = Input::file('signature')->getClientOriginalExtension();
$photo = $filename . '.' . $ext;
Input::file('signature')->move($destination, $photo);
$member->signature = $photo;
}
$member->name = Input::get('name');
$member->id_number = Input::get('id_number');
$member->membership_no = Input::get('membership_no');
$member->phone = Input::get('phone');
$member->email = Input::get('email');
$member->address = Input::get('address');
$member->monthly_remittance_amount = Input::get('monthly_remittance_amount');
$member->gender = Input::get('gender');
if (Input::get('active') == '1') {
$member->is_active = TRUE;
} else {
$member->is_active = FALSE;
}
$member->save();
$member_id = $member->id;
if (Input::get('share_account') == '1') {
Shareaccount::createAccount($member_id);
}
Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'member creation', 'Member', '0');
return Redirect::route('members.index');
}
示例13: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Member();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Member'])) {
$model->attributes = $_POST['Member'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->memb_id));
}
}
$this->render('create', array('model' => $model));
}
示例14: createCluster
private function createCluster($memberNum)
{
$memberIds = array();
for($i = 0; $i < $memberNum; ++$i)
{
$member = new Member();
$member->setName('dummy');
$member->setIsActive(true);
$member->save();
$memberIds[] = $member->getId();
$member->setName(sprintf('dummy%d', $member->getId()));
$member->save();
$address = sprintf('sns%d@example.com', $member->getId());
$this->setMemberConfig($member->getId(), 'pc_address', $address);
$this->setMemberConfig($member->getId(), 'mobile_address', $address);
$password = 'password';
$this->setMemberConfig($member->getId(), 'password', md5($password));
$member->free(true);
}
for($i = 0; $i < $memberNum; ++$i)
{
for($j = $i + 1; $j < $memberNum; ++$j)
{
if ($i === $j) continue;
$relation = new MemberRelationship();
$relation->setMemberIdFrom($memberIds[$i]);
$relation->setMemberIdTo($memberIds[$j]);
$relation->setFriend(true);
$relation->save();
$relation->free(true);
}
}
}
示例15: actionRegister
public function actionRegister()
{
if (Yii::app()->user->id) {
$this->redirect(Yii::app()->user->returnUrl);
}
$model = new Member();
// Uncomment the following line if AJAX validation is needed
//$this->performAjaxValidation($model);
if (isset($_POST['Member'])) {
$model->attributes = $_POST['Member'];
if ($_POST['Member']['password'] && $_POST['Member']['mname'] && $_POST['Member']['passwordrepeat']) {
$name = $model->findByAttributes(array('mname' => $_POST['Member']['mname']));
if ($name) {
header("Content-Type: text/html; charset=utf-8");
echo "<script language='javascript'>alert('用户名已经注册请选择其他的用户名!'); location.reload();</script>";
exit;
}
if ($_POST['Member']['password'] != $_POST['Member']['passwordrepeat']) {
/*throw new CHttpException(404,'两次输入的密码不一致!');
$this->redirect(array('view','id'=>$model->id));*/
header("Content-Type: text/html; charset=utf-8");
echo "<script language='javascript'>alert('两次输入的密码不一致!'); location.reload();</script>";
exit;
}
if ($this->createAction('captcha')->getVerifyCode() != $_POST['Member']['verifyCode']) {
header("Content-Type: text/html; charset=utf-8");
echo "<script language='javascript'>alert('验证码输入错误!'); location.reload();</script>";
exit;
}
if ('agree' != $_POST['Member']['clause']) {
header("Content-Type: text/html; charset=utf-8");
echo "<script language='javascript'>alert('请仔细阅读条款!'); location.reload();</script>";
exit;
}
} else {
header("Content-Type: text/html; charset=utf-8");
echo "<script language='javascript'>alert('请输入昵称或密码!'); location.reload();</script>";
exit;
}
if ($model->save(false)) {
$this->redirect(Yii::app()->user->returnUrl);
} else {
header("Content-Type: text/html; charset=utf-8");
echo "<script language='javascript'>alert('真实姓名跟身份证格式不正确,姓名只能是中文,身份证是15到18位!'); location.reload();</script>";
exit;
}
}
$this->render('register', array('model' => $model));
}