本文整理汇总了PHP中Status::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::save方法的具体用法?PHP Status::save怎么用?PHP Status::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('cs_status')->delete();
$status = array("Open", "In Progress", "Close", "Cancel");
foreach ($status as $stt) {
$status = new Status();
$status->name = $stt;
$status->description = "Lorem Ipsum has been the dummy text ever since the 1500s";
$status->save();
}
}
示例2: 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->aOfferVoucher1 !== null) {
if ($this->aOfferVoucher1->isModified() || $this->aOfferVoucher1->isNew()) {
$affectedRows += $this->aOfferVoucher1->save($con);
}
$this->setOfferVoucher1($this->aOfferVoucher1);
}
if ($this->aStatus !== null) {
if ($this->aStatus->isModified() || $this->aStatus->isNew()) {
$affectedRows += $this->aStatus->save($con);
}
$this->setStatus($this->aStatus);
}
if ($this->isNew()) {
$this->modifiedColumns[] = SalesPeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = SalesPeer::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 += SalesPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collPurchaseDetails !== null) {
foreach ($this->collPurchaseDetails as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Status();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Status'])) {
$model->attributes = $_POST['Status'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例4: postCreate
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function postCreate()
{
$validator = Validator::make(Input::all(), Status::$rules);
if ($validator->passes()) {
$status = new Status();
$data = Input::all();
$status->fill($data);
$status->date = date("Y-m-d", strtotime(Input::get('date')));
$status->save();
return Redirect::to(Input::get('url') . '#' . $status->id)->with('confirmation', '¡El nuevo status a sido guardado!');
} else {
// validation has failed, display error messages
return Redirect::to(Input::get('url') . "#formStatus")->with('message-box', 'Debes corregir los siguientes campos:')->withErrors($validator)->withInput();
}
}
示例5: store
/**
* Store a newly created resource in storage.
* POST /projectstatus
*
* @return Response
*/
public function store()
{
Input::merge(array_map('trim', Input::all()));
$input_all = Input::all();
$validation = Validator::make($input_all, Status::$rules);
if ($validation->passes()) {
$status = new Status();
$status->status = strtoupper(Input::get('project_status'));
$status->description = strtoupper(Input::get('description'));
$status->save();
return Redirect::route('project.status.index')->with('class', 'success')->with('message', 'Record successfully created.');
} else {
return Redirect::route('project.status.create')->withInput()->withErrors($validation)->with('class', 'error')->with('message', 'There were validation error.');
}
}
示例6: store
public function store()
{
$rules = ['name' => 'required', 'address' => 'required', 'postal_code' => 'required', 'email' => 'required|email', 'phone' => 'required'];
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
} else {
$password = Input::get('password');
if (Input::has('store_id')) {
$id = Input::get('store_id');
$store = StoreModel::find($id);
if ($password !== '') {
$store->secure_key = md5($store->salt . $password);
}
} else {
$store = new StoreModel();
if ($password === '') {
$alert['msg'] = 'You have to enter password';
$alert['type'] = 'danger';
return Redirect::route('company.store.create')->with('alert', $alert);
}
$store->salt = str_random(8);
$store->token = str_random(8);
$store->secure_key = md5($store->salt . $password);
$store->company_id = Session::get('company_id');
}
$store->name = Input::get('name');
$store->address = Input::get('address');
$store->postal_code = Input::get('postal_code');
$store->email = Input::get('email');
$store->phone = Input::get('phone');
$store->description = Input::get('description');
$store->save();
if (!Input::has('store_id')) {
$status = new StatusModel();
$status->store_id = $store->id;
$startNo = rand(1, 100);
$status->current_queue_no = $startNo;
$status->last_queue_no = $startNo;
$status->save();
}
$alert['msg'] = 'Store has been saved successfully';
$alert['type'] = 'success';
return Redirect::route('company.store')->with('alert', $alert);
}
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
if (!empty(Input::get('name'))) {
$val = Status::validate(Input::all());
if ($val->fails()) {
return Redirect::back()->withErrors($val);
}
try {
$status = new Status();
$status->name = Input::get('name');
$status->save();
} catch (Exception $e) {
return Redirect::back()->with('message', FlashMessage::DisplayAlert('Status can NOT be created. Already exists.', 'alert'));
}
return Redirect::back()->with('message', FlashMessage::DisplayAlert('Status Created Successfully!', 'success'));
}
return Redirect::back()->with('message', FlashMessage::DisplayAlert('Enter a valid status name.', 'alert'));
}
示例8: add_status
public function add_status()
{
$inputs = Input::all();
$rules = array('status_nombre' => 'required|max:20|unique:status,status_nombre');
$validator = Validator::make($inputs, $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator);
} else {
$status = new Status();
$status->status_nombre = Input::get('status_nombre');
if ($status->save()) {
Session::flash('message', 'Guardado Correctamente');
Session::flash('class', 'success');
} else {
Session::flash('message', 'Ha ocurrido un error, intentelo nuevamente');
Session::flash('class', 'danger');
}
return Redirect::to('status');
}
}
示例9: updateStatus
function updateStatus($id)
{
if (is_null($id)) {
Functions::setResponse(400);
}
$data = Functions::getJSONData();
try {
$s = new Status($id);
foreach ($s->getFields() as $field) {
$value = Functions::elt($data, $field['name']);
if (is_null($value)) {
Functions::setResponse(400);
}
$s->set($field['name'], $value);
}
$s->set('id', $id);
$s->save();
return true;
} catch (RuntimeException $e) {
Functions::setResponse(404);
}
}
示例10: Status
} else {
//if the item was changed successfully, add to array
$changes[] = "<strong>" . $value . "</strong> was not updated successfully.";
$changes[] = $database->last_error;
}
}
}
}
//now we're done with all updates
//check to see if we need to create a new status record
//only if it's not blank
if (!empty($_POST['new_status'])) {
$new_status = new Status();
$new_status->name = $_POST['new_status'];
//try to save
if ($new_status->save()) {
$changes[] = "<strong>" . $new_status->name . "</strong> was created successfully!";
} else {
$changes[] = "<strong>" . $new_status->name . "</strong> was not created successfully!";
}
$changes[] = $database->last_error;
}
//at this point, we're done with all changes
//check to see if there are any changes, if so, make them into messages
if (count($changes) != 0) {
$session->message(implode("<br />", $changes));
}
//lastly, redirect back to itself
redirect_head(current_url());
}
//header template
示例11: addStatus
public function addStatus($user)
{
$loggedInUser = $this->registry->getObject('authenticate')->getUser()->getUserID();
if ($loggedInUser == $user) {
require_once 'status.php';
if (isset($_POST['status_type']) && $_POST['status_type'] != 'update') {
if ($_POST['status_type'] == 'image') {
require_once 'imagestatus.php';
$status = new Imagestatus($this->registry, 0, $this->username);
$status->processImage('image_file');
} elseif ($_POST['status_type'] == 'video') {
require_once 'videostatus.php';
$status = new Videostatus($this->registry, 0, $this->username);
$status->setVideoIdFromURL($_POST['video_url']);
} elseif ($_POST['status_type'] == 'link') {
require_once 'linkstatus.php';
$status = new Linkstatus($this->registry, 0);
$status->setURL($this->registry->getObject('db')->sanitizeData($_POST['link_url']));
$status->setDescription($this->registry->getObject('db')->sanitizeData($_POST['link_description']));
}
} else {
$status = new Status($this->registry, 0);
}
$status->setProfile($user);
$status->setPoster($loggedInUser);
if (isset($_POST['status'])) {
$status->setStatus($this->registry->getObject('db')->sanitizeData($_POST['status']));
}
$status->generateType();
$status->save();
// success message display
$this->registry->getObject('template')->addTemplateBit('status_update_message', 'profile_status_update_confirm.php');
} else {
require_once 'relation.php';
$relationships = new RelationsGet($this->registry);
$connections = $relationships->getNetwork($user, false);
if (in_array($loggedInUser, $connections)) {
require_once 'status.php';
if (isset($_POST['status_type']) && $_POST['status_type'] != 'update') {
if ($_POST['status_type'] == 'image') {
require_once 'imagestatus.php';
$status = new Imagestatus($this->registry, 0, $this->username);
$status->processImage('image_file');
} elseif ($_POST['status_type'] == 'video') {
require_once 'videostatus.php';
$status = new Videostatus($this->registry, 0, $this->username);
$status->setVideoIdFromURL($_POST['video_url']);
} elseif ($_POST['status_type'] == 'link') {
require_once 'linkstatus.php';
$status = new Linkstatus($this->registry, 0);
$status->setURL($this->registry->getObject('db')->sanitizeData($_POST['link_url']));
$status->setDescription($this->registry->getObject('db')->sanitizeData($_POST['link_description']));
}
} else {
$status = new Status($this->registry, 0);
}
$status->setProfile($user);
$status->setPoster($loggedInUser);
$status->setStatus($this->registry->getObject('db')->sanitizeData($_POST['status']));
$status->generateType();
$status->save();
// success message display
$this->registry->getObject('template')->addTemplateBit('status_update_message', 'profile_status_post_confirm.php');
} else {
// error message display
$this->registry->getObject('template')->addTemplateBit('status_update_message', 'profile_status_error.php');
}
}
}
示例12: addStatus
private function addStatus($array, $user)
{
$loggedIn = $this->registry->getObject('authenticate')->isLoggedIn();
if ($loggedIn == true) {
require_once 'status.php';
if (isset($_POST['status_type']) && $_POST['status_type'] != 'update') {
if ($_POST['status_type'] == 'image') {
require_once 'imagestatus.php';
$status = new Imagestatus($this->registry, 0, $user);
$status->processImage('image_file');
} elseif ($_POST['status_type'] == 'video') {
require_once 'videostatus.php';
$status = new Videostatus($this->registry, 0, $user);
$status->setVideoIdFromURL($_POST['video_url']);
} elseif ($_POST['status_type'] == 'link') {
require_once 'linkstatus.php';
$status = new Linkstatus($this->registry, 0);
$status->setURL($this->registry->getObject('db')->sanitizeData($_POST['link_url']));
$status->setDescription($this->registry->getObject('db')->sanitizeData($_POST['link_description']));
}
} else {
$status = new Status($this->registry, 0);
}
$status->setProfile($user);
$status->setPoster($user);
if (isset($_POST['status'])) {
$status->setStatus($this->registry->getObject('db')->sanitizeData($_POST['status']));
}
$status->generateType();
$status->save();
$newAddID = $status->getID();
//Status Wierdness Start
$this->registry->getObject('template')->getPage()->addTag('referer', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
require_once 'stream.php';
$stream = new Stream($this->registry);
$status = $stream->getStatusByID($newAddID);
$statusTypes = $stream->getStatusType();
if (!$stream->isEmpty()) {
$this->registry->getObject('template')->buildFromTemplate('stream_more.php');
}
$streamdata = $stream->getStream();
$IDs = $stream->getIDs();
$cacheableIDs = array();
foreach ($IDs as $id) {
$i = array();
$i['status_id'] = $id;
$cacheableIDs[] = $i;
}
$cache = $this->registry->getObject('db')->cacheData($cacheableIDs);
$this->registry->getObject('template')->getPage()->addTag('stream', array('DATA', $cache));
//var_dump($cacheableIDs);
foreach ($streamdata as $data) {
$datatags = array();
foreach ($data as $tag => $value) {
$datatags['status' . $tag] = $value;
}
//var_dump($datatags);
// your own status updates
if ($data['profile'] == 0) {
// network updates
$this->addBit('stream-' . $data['ID'], 'updates/' . $data['type_reference'] . '-general.php', $datatags);
} elseif ($data['profile'] == $this->registry->getObject('authenticate')->getUser()->getUserID() && $data['poster'] == $this->registry->getObject('authenticate')->getUser()->getUserID()) {
$this->registry->getObject('template')->addTemplateBit('stream-' . $data['ID'], 'updates/' . $data['type_reference'] . '-self.php', $datatags);
} elseif ($data['profile'] == $this->registry->getObject('authenticate')->getUser()->getUserID()) {
// updates to you
$this->addBit('stream-' . $data['ID'], 'updates/' . $data['type_reference'] . '-toSelf.php', $datatags);
} elseif ($data['poster'] == $this->registry->getObject('authenticate')->getUser()->getUserID()) {
// updates by you
$this->addBit('stream-' . $data['ID'], 'updates/' . $data['type_reference'] . '-fromSelf.php', $datatags);
} elseif ($data['poster'] == $data['profile']) {
$this->addBit('stream-' . $data['ID'], 'updates/' . $data['type_reference'] . '-user.php', $datatags);
} else {
// network updates
$this->addBit('stream-' . $data['ID'], 'updates/' . $data['type_reference'] . '.php', $datatags);
}
}
// stream comments, likes and dislikes
$status_ids = implode(',', $IDs);
$start = array();
foreach ($IDs as $id) {
$start[$id] = array();
}
// comments
$this->generateComments($start, $status_ids);
//rates
$this->getRates('status', $IDs);
//$this->getRates('comments', $IDs);
$this->registry->getObject('template')->getPage()->addTag('offset', 20);
//$offset +
$this->registry->getObject('template')->parseOutput();
$this->registry->ajaxReply(array('content' => $this->registry->getObject('template')->getPage()->getContentToPrint(), 'status' => 'Status Added'));
//$this->registry->ajaxReply(array('content' => '<script>$(document).ready(function(){window.location.reload();})</script>', 'status' => 'Status Added'));
//Status Wierdness End
// success message display
//$this->registry->ajaxReply( array('status'=>'Status Added', 'content'=>'') );
//$this->registry->getObject('template')->addTemplateBit( 'status_update_message', 'profile_status_update_confirm.php' );
} else {
//$this->registry->ajaxReply( array('status'=>'Access Denied', 'content'=>'') );
$this->registry->errorPage('Access Denied', 'Login to continue');
}
//.........这里部分代码省略.........
示例13: run
public function run()
{
DB::table('statuses')->truncate();
$status = new Status();
$status->name = "Đơn hàng mới";
$status->tran_type_id = 1;
$status->color = "Grey";
$status->type = "Đơn hàng mới";
$status->save();
$status = new Status();
$status->name = "Xác nhận còn hàng";
$status->tran_type_id = 1;
$status->color = "Red";
$status->type = "Đang xử lý";
$status->save();
$status = new Status();
$status->name = "Chừa hàng";
$status->tran_type_id = 1;
$status->color = "Red";
$status->type = "Đang xử lý";
$status->save();
$status = new Status();
$status->name = "Đã chuyển khoản";
$status->tran_type_id = 1;
$status->color = "Red";
$status->type = "Đang xử lý";
$status->save();
$status = new Status();
$status->name = "Đã gói hàng chờ chuyển";
$status->tran_type_id = 1;
$status->color = "Red";
$status->type = "Đang xử lý";
$status->save();
$status = new Status();
$status->name = "Đã chuyển hàng";
$status->tran_type_id = 1;
$status->color = "Red";
$status->type = "Đang xử lý";
$status->save();
$status = new Status();
$status->name = "Đã nhận hàng";
$status->tran_type_id = 1;
$status->color = "Green";
$status->type = "Hoàn tất";
$status->save();
$status = new Status();
$status->name = "Báo hết hàng";
$status->tran_type_id = 1;
$status->color = "Green";
$status->type = "Hoàn tất";
$status->save();
$status = new Status();
$status->name = "Khách hủy đơn";
$status->tran_type_id = 1;
$status->color = "Green";
$status->type = "Hoàn tất";
$status->save();
$status = new Status();
$status->name = "Khách trả hàng";
$status->tran_type_id = 1;
$status->color = "Green";
$status->type = "Hoàn tất";
$status->save();
//COD
$status = new Status();
$status->name = "Đơn hàng mới";
$status->tran_type_id = 2;
$status->color = "Grey";
$status->type = "Đơn hàng mới";
$status->save();
$status = new Status();
$status->name = "Xác nhận còn hàng";
$status->tran_type_id = 2;
$status->color = "Red";
$status->type = "Đang xử lý";
$status->save();
$status = new Status();
$status->name = "Chừa hàng";
$status->tran_type_id = 2;
$status->color = "Red";
$status->type = "Đang xử lý";
$status->save();
$status = new Status();
$status->name = "Đã gói hàng chờ chuyển";
$status->tran_type_id = 2;
$status->color = "Red";
$status->type = "Đang xử lý";
$status->save();
$status = new Status();
$status->name = "Đã chuyển hàng";
$status->tran_type_id = 2;
$status->color = "Red";
$status->type = "Đang xử lý";
$status->save();
$status = new Status();
$status->name = "Đã nhận hàng và thanh toán";
$status->tran_type_id = 2;
$status->color = "Green";
$status->type = "Hoàn tất";
$status->save();
//.........这里部分代码省略.........
示例14: doSave
/**
* Stores the object 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 Connection $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($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->aUser !== null) {
if ($this->aUser->isModified()) {
$affectedRows += $this->aUser->save($con);
}
$this->setUser($this->aUser);
}
if ($this->aSchemaPropertyElement !== null) {
if ($this->aSchemaPropertyElement->isModified()) {
$affectedRows += $this->aSchemaPropertyElement->save($con);
}
$this->setSchemaPropertyElement($this->aSchemaPropertyElement);
}
if ($this->aSchemaPropertyRelatedBySchemaPropertyId !== null) {
if ($this->aSchemaPropertyRelatedBySchemaPropertyId->isModified()) {
$affectedRows += $this->aSchemaPropertyRelatedBySchemaPropertyId->save($con);
}
$this->setSchemaPropertyRelatedBySchemaPropertyId($this->aSchemaPropertyRelatedBySchemaPropertyId);
}
if ($this->aSchema !== null) {
if ($this->aSchema->isModified()) {
$affectedRows += $this->aSchema->save($con);
}
$this->setSchema($this->aSchema);
}
if ($this->aProfileProperty !== null) {
if ($this->aProfileProperty->isModified()) {
$affectedRows += $this->aProfileProperty->save($con);
}
$this->setProfileProperty($this->aProfileProperty);
}
if ($this->aSchemaPropertyRelatedByRelatedSchemaPropertyId !== null) {
if ($this->aSchemaPropertyRelatedByRelatedSchemaPropertyId->isModified()) {
$affectedRows += $this->aSchemaPropertyRelatedByRelatedSchemaPropertyId->save($con);
}
$this->setSchemaPropertyRelatedByRelatedSchemaPropertyId($this->aSchemaPropertyRelatedByRelatedSchemaPropertyId);
}
if ($this->aStatus !== null) {
if ($this->aStatus->isModified()) {
$affectedRows += $this->aStatus->save($con);
}
$this->setStatus($this->aStatus);
}
if ($this->aFileImportHistory !== null) {
if ($this->aFileImportHistory->isModified()) {
$affectedRows += $this->aFileImportHistory->save($con);
}
$this->setFileImportHistory($this->aFileImportHistory);
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = SchemaPropertyElementHistoryPeer::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 += SchemaPropertyElementHistoryPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例15: postStatus
public function postStatus($doc)
{
$toAdd = null;
$status = Input::get('status');
$doc = Doc::find($doc);
if (!isset($status)) {
$doc->statuses()->sync(array());
} else {
$toAdd = Status::where('label', $status['text'])->first();
if (!isset($toAdd)) {
$toAdd = new Status();
$toAdd->label = $status['text'];
}
$toAdd->save();
$doc->statuses()->sync(array($toAdd->id));
}
$response['messages'][0] = array('text' => 'Document saved', 'severity' => 'info');
return Response::json($response);
}