本文整理匯總了PHP中type::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::save方法的具體用法?PHP type::save怎麽用?PHP type::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: lastSeenEvent
/**
* Event - triggered every beforeFilter-callback.
* Sets the date and time when the user is last seen.
*
* @param \Cake\Event\Event $event Event.
* @return void
*/
public function lastSeenEvent($event)
{
$user = $this->_getUsermetas();
if ($user) {
$user->set('last_seen', Time::now());
$this->Usermetas->save($user);
}
}
示例2: get
/** Perform a curl request based on url provided
* @access public
* @uses Zend_Cache
* @uses Zend_Json_Decoder
* @param string $method
* @param array $params
*/
public function get($method, array $params)
{
$this->_url = $this->_createUrl($method, $params);
if (!$this->_cache->test(md5($this->_url))) {
$config = array('adapter' => 'Zend_Http_Client_Adapter_Curl', 'curloptions' => array(CURLOPT_POST => true, CURLOPT_USERAGENT => $this->_getUserAgent(), CURLOPT_FOLLOWLOCATION => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_LOW_SPEED_TIME => 1));
$client = new Zend_Http_Client($this->_url, $config);
$response = $client->request();
$data = $response->getBody();
$this->_cache->save($data);
} else {
$data = $this->_cache->load(md5($this->_url));
}
if ($this->getFormat() === 'json') {
return $this->_decoder($data);
} else {
return $data;
}
}
示例3: save_codejercicio
/**
* Establece un ejercicio como predeterminado para este usuario
* @param type $cod el código del ejercicio
*/
protected function save_codejercicio($cod)
{
if ($cod != $this->user->codejercicio) {
$this->default_items->set_codejercicio($cod);
$this->user->codejercicio = $cod;
if (!$this->user->save()) {
$this->new_error_msg('Error al establecer el ejercicio ' . $cod . ' como ejercicio predeterminado para este usuario.');
}
}
}
示例4: addOrUpdateGlobalStatus
/**
* add or update global status (query)
* @param type $o
* @param type $data
*/
protected function addOrUpdateGlobalStatus($o, $data)
{
$o->name = $data['name'];
$o->manual_order = $data['manual_order'];
$o->color = $data['color'];
$flags = array('flag_first' => 0, 'flag_unreg' => 0, 'flag_error' => 0, 'flag_payment' => 0, 'flag_delivery' => 0, 'flag_close' => 0, 'secret' => 0);
if (!empty($data['flag'])) {
$flags[$data['flag']] = 1;
}
$o->fill($flags);
$o->save();
}
示例5: create_item
/**
* Создание категории точек на Google Maps
* @param type $page_id ID страницы
* @param type $model Ссылка на обрабатываемую модель
*/
public function create_item($page_id = null, $model)
{
$controller = Yii::app()->getController();
if (isset($_POST['ModuleYmapsCategories'])) {
$_POST['ModuleYmapsCategories']['mpage_id'] = ModulesInPages::model()->getLink($page_id, $this->module_id);
$model->attributes = $_POST['ModuleYmapsCategories'];
if ($model->save()) {
Yii::app()->user->setFlash($this->module_id . '_add_message', '<p style="color:green;">Добавлено</p>');
$controller->redirect(Yii::app()->baseUrl . '?r=pages/update&id=' . $page_id . '&/#!/tab_' . $this->module_id);
} else {
Yii::app()->user->setFlash($this->module_id . '_add_message', '<p style="color:red;">Ошибка</p>');
}
}
}
示例6: resourceToModel
/**
* @param type $res
* @param type $measurement
*
* @return type
*/
public function resourceToModel($res, $measurement)
{
//$measurement->patient_id = $res->patient_id;
foreach ($res as $key => $value) {
if ($key == 'resourceType') {
continue;
}
$measurement->{$key} = $value;
}
$saved = $measurement->save();
if (!$saved) {
print_r($measurement->getErrors());
}
return $measurement;
}
示例7: save
/**
* Saves the profile field type
*
* The settings/configuration for a ProfileFieldType are saved in ProfileField
* in attribute "field_type_config" as JSON data.
*
* The ProfileFieldType Class itself can overwrite this behavior.
*/
public function save()
{
$data = array();
foreach ($this->attributeNames() as $attributeName) {
// Dont save profile field attribute
if ($attributeName == 'profileField') {
continue;
}
$data[$attributeName] = $this->{$attributeName};
}
$this->profileField->field_type_config = CJSON::encode($data);
$this->profileField->save();
// Clear Database Schema
Yii::app()->db->schema->getTable('profile', true);
Profile::model()->refreshMetaData();
}
示例8: save
/**
* Saves the profile field type
*
* The settings/configuration for a ProfileFieldType are saved in ProfileField
* in attribute "field_type_config" as JSON data.
*
* The ProfileFieldType Class itself can overwrite this behavior.
*/
public function save()
{
$data = array();
foreach ($this->attributes as $attributeName => $value) {
// Dont save profile field attribute
if ($attributeName == 'profileField') {
continue;
}
$data[$attributeName] = $this->{$attributeName};
}
$this->profileField->field_type_config = \yii\helpers\Json::encode($data);
if (!$this->profileField->save()) {
throw new \yii\base\Exception("Could not save profile field!");
}
// Clear Database Schema
Yii::$app->getDb()->getSchema()->getTableSchema(\humhub\modules\user\models\Profile::tableName(), true);
return true;
}
示例9: run
/**
* This method prepares the response of the current element based on the
* $bean object and the $flowData, an external action such as
* ROUTE or ADHOC_REASSIGN could be also processed.
*
* This method probably should be override for each new element, but it's
* not mandatory. However the response structure always must pass using
* the 'prepareResponse' Method.
*
* As defined in the example:
*
* $response['route_action'] = 'ROUTE'; //The action that should process the Router
* $response['flow_action'] = 'CREATE'; //The record action that should process the router
* $response['flow_data'] = $flowData; //The current flowData
* $response['flow_filters'] = array('first_id', 'second_id'); //This attribute is used to filter the execution of the following elements
* $response['flow_id'] = $flowData['id']; // The flowData id if present
*
*
* @param type $flowData
* @param type $bean
* @param type $externalAction
* @return type
*/
public function run($flowData, $bean = null, $externalAction = '', $arguments = array())
{
switch ($externalAction) {
case 'RESUME_EXECUTION':
$flowAction = 'UPDATE';
break;
default:
$flowAction = 'CREATE';
break;
}
$bpmnElement = $this->retrieveDefinitionData($flowData['bpmn_id']);
$act_assign_user = $bpmnElement['act_assign_user'];
$userData = $this->retrieveUserData($act_assign_user);
if (isset($bean->field_name_map['assigned_user_id']) && (isset($userData->id) && $userData->id == $act_assign_user)) {
$this->logger->debug("Assign user to '{$act_assign_user}'");
$bean->skipPartialUpdate = true;
$historyData = $this->retrieveHistoryData($flowData['cas_sugar_module']);
$historyData->savePreData('assigned_user_id', $flowData['cas_user_id']);
//$bean->assigned_user_id = $act_assign_user;
if (isset($bpmnElement['act_update_record_owner']) && $bpmnElement['act_update_record_owner'] == 1) {
$bean->assigned_user_id = $act_assign_user;
$bean->save();
}
$flowData['cas_user_id'] = $act_assign_user;
$historyData->savePostData('assigned_user_id', $act_assign_user);
//$bean->team_id = '1';
$params = array();
$params['cas_id'] = $flowData['cas_id'];
$params['cas_index'] = $flowData['cas_index'];
$params['act_id'] = $bpmnElement['id'];
$params['pro_id'] = $bpmnElement['pro_id'];
$params['user_id'] = $this->currentUser->id;
$params['frm_action'] = 'Assing user';
$params['frm_comment'] = 'Assing user Applied';
$params['log_data'] = $historyData->getLog();
$this->caseFlowHandler->saveFormAction($params);
// just update the record instead
//$query = "update pmse_bpm_flow set " .
// " cas_user_id = '$act_assign_user' " .
// " where cas_id = {$flowData['cas_id']} and cas_index = {$flowData['cas_index']} ";
//$bean->db->query($query);
}
return $this->prepareResponse($flowData, 'ROUTE', $flowAction);
}
示例10: updateProcessDefinition
/**
*
* @param type $args
*/
public function updateProcessDefinition($args)
{
$this->initWrapper();
//Update ProcessDefinition
$this->processDefinition = $this->getBean('pmse_BpmProcessDefinition')->retrieve_by_string_fields(array('prj_id' => $args['record']));
//Update Diagrams
$this->diagram = $this->getBean('pmse_BpmnDiagram')->retrieve_by_string_fields(array('prj_id' => $args['record']));
//Update Process
$this->process = $this->getBean('pmse_BpmnProcess')->retrieve_by_string_fields(array('prj_id' => $args['record']));
foreach ($args as $key => $value) {
$this->diagram->{$key} = $value;
$this->process->{$key} = $value;
$this->processDefinition->{$key} = $value;
}
$this->diagram->save();
$this->process->save();
$this->processDefinition->save();
$this->notify();
}
示例11: _cancelRefundOrder
/**
* Annulation des remboursement de la commande
* @param type $order
*/
protected function _cancelRefundOrder($order)
{
//On mets tous les champs relatifs au remboursement à NULL
$order->setBaseDiscountRefunded(NULL);
$order->setBaseShippingTaxRefunded(NULL);
$order->setBaseSubtotalRefunded(NULL);
$order->setBaseTaxRefunded(NULL);
$order->setBaseTotalOfflineRefunded(NULL);
$order->setBaseTotalOnlineRefunded(NULL);
$order->setBaseTotalRefunded(NULL);
$order->setBaseHiddenTaxRefunded(NULL);
$order->setDiscountRefunded(NULL);
$order->setShippingTaxRefunded(NULL);
$order->setSubtotalRefunded(NULL);
$order->setTaxRefunded(NULL);
$order->setTotalOfflineRefunded(NULL);
$order->setTotalOnlineRefunded(NULL);
$order->setTotalRefunded(NULL);
$order->setBaseHiddenTaxRefunded(NULL);
$order->save();
}
示例12: update
/**
* Update user records
* @param type $model
*/
protected function update($model)
{
$model_class_name = $model->getClassName();
if (isset($_POST[$model_class_name])) {
$model->attributes = $_POST[$model_class_name];
if ($model->save()) {
Yii::app()->user->setFlash('success', Lang::t('SUCCESS_MESSAGE'));
$this->refresh();
}
}
}
示例13: atualizaAnaliseProrrogacao
/**
*
* @param type $prorrogacaoRow
* @param type $observacao
* @param type $atendimento
* @param type $logon
* @param type $dataInicial
* @param type $dataFinal
*/
public function atualizaAnaliseProrrogacao($prorrogacaoRow, $observacao, $atendimento, $logon, $dataInicial, $dataFinal)
{
$prorrogacaoRow->Observacao = $observacao;
$prorrogacaoRow->Atendimento = $atendimento;
$prorrogacaoRow->Logon = $logon;
$prorrogacaoRow->DtInicio = Data::dataAmericana($dataInicial);
$prorrogacaoRow->DtFinal = Data::dataAmericana($dataFinal);
$prorrogacaoRow->save();
}
示例14: getActivityContent
/**
* Return activity content by given user.
*
* This output is generated by current mode.
*
* @param type $user
* @return string
*/
private function getActivityContent($user)
{
$receive_email_activities = $user->getSetting("receive_email_activities", 'core', HSetting::Get('receive_email_activities', 'mailing'));
// User never wants activity content
if ($receive_email_activities == User::RECEIVE_EMAIL_NEVER) {
return "";
}
// We are in hourly mode and user wants receive a daily summary
if ($this->mode == 'hourly' && $receive_email_activities == User::RECEIVE_EMAIL_DAILY_SUMMARY) {
return "";
}
// We are in daily mode and user wants receive not daily
if ($this->mode == 'daily' && $receive_email_activities != User::RECEIVE_EMAIL_DAILY_SUMMARY) {
return "";
}
// User is online and want only receive when offline
if ($this->mode == 'hourly') {
$isOnline = count($user->httpSessions) > 0;
if ($receive_email_activities == User::RECEIVE_EMAIL_WHEN_OFFLINE && $isOnline) {
return "";
}
}
$lastMailDate = $user->last_activity_email;
if ($lastMailDate == "" || $lastMailDate == "0000-00-00 00:00:00") {
$lastMailDate = new CDbExpression('NOW() - INTERVAL 24 HOUR');
}
// Get Stream contents
$action = new StreamAction(null, 'console');
$action->mode = StreamAction::MODE_ACTIVITY;
$action->type = Wall::TYPE_DASHBOARD;
$action->userId = $user->id;
$action->userWallId = $user->wall_id;
$action->wallEntryLimit = 50;
$action->wallEntryDateTo = $lastMailDate;
$activities = $action->runConsole();
# Save last run
$user->last_activity_email = new CDbExpression('NOW()');
$user->save();
// Nothin new
if ($activities['counter'] == 0) {
return "";
}
// Return Output
return $activities['output'];
}
示例15: _addStatusHistoryComment
/**
* @desc order comments or history
* @param type $order
* @param Varien_Object $response
*/
protected function _addStatusHistoryComment($order, Varien_Object $response, $status = false)
{
Mage::log("_addStatusHistoryComment", Zend_Log::DEBUG, "adyen_notification.log", true);
//notification
$pspReference = $response->getData('pspReference');
$success = trim($response->getData('success'));
$success_result = strcmp($success, 'false') == 0 || !$success ? 'false' : 'true';
$eventCode = $response->getData('eventCode');
$reason = $response->getData('reason');
$success = !empty($reason) ? "{$success_result} <br />reason:{$reason}" : $success_result;
$klarnaReservationNumber = $response->getData('additionalData_additionalData_acquirerReference');
$boletoPaidAmount = $response->getData('additionalData_boletobancario_paidAmount');
//post
$authResult = $response->getData('authResult');
$pspReference = $response->getData('pspReference');
//payment method
$paymentMethod = $response->getData('paymentMethod');
//data type
$type = !empty($authResult) ? 'Adyen Result URL Notification(s):' : 'Adyen HTTP Notification(s):';
switch ($type) {
case 'Adyen Result URL Notification(s):':
/*PCD*/
// choose not to update the adyen_event_code in the order when the order is already on notification:Authorisation status and authresult = resultURL:Authorised
if (!(substr($order->getAdyenEventCode(), 0, 13) == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISATION && $authResult == Adyen_Payment_Model_Event::ADYEN_EVENT_AUTHORISED)) {
Mage::log("Adyen Result URL order authResult:" . $authResult, Zend_Log::DEBUG, "adyen_notification.log", true);
$order->setAdyenEventCode($authResult);
}
$comment = Mage::helper('adyen')->__('%s <br /> authResult: %s <br /> pspReference: %s <br /> paymentMethod: %s', $type, $authResult, $pspReference, $paymentMethod);
break;
default:
Mage::log("default order authResult:" . $eventCode . " : " . strtoupper($success_result), Zend_Log::DEBUG, "adyen_notification.log", true);
if ($eventCode == Adyen_Payment_Model_Event::ADYEN_EVENT_REFUND) {
$currency = $order->getOrderCurrencyCode();
// check if it is a full or partial refund
$amount = Mage::helper('adyen')->formatAmount($response->getValue() / 100, $currency);
$orderAmount = Mage::helper('adyen')->formatAmount($order->getGrandTotal(), $currency);
if ($amount == $orderAmount) {
$order->setAdyenEventCode($eventCode . " : " . strtoupper($success_result));
} else {
$order->setAdyenEventCode("(PARTIAL) " . $eventCode . " : " . strtoupper($success_result));
}
} else {
$order->setAdyenEventCode($eventCode . " : " . strtoupper($success_result));
}
// if payment method is klarna or openinvoice/afterpay show the reservartion number
if (($paymentMethod == "klarna" || $paymentMethod == "afterpay_default" || $paymentMethod == "openinvoice") && ($klarnaReservationNumber != null && $klarnaReservationNumber != "")) {
$klarnaReservationNumberText = "<br /> reservationNumber: " . $klarnaReservationNumber;
} else {
$klarnaReservationNumberText = "";
}
if ($boletoPaidAmount != null && $boletoPaidAmount != "") {
$boletoPaidAmountText = "<br /> Paid amount: " . $boletoPaidAmount;
} else {
$boletoPaidAmountText = "";
}
$comment = Mage::helper('adyen')->__('%s <br /> eventCode: %s <br /> pspReference: %s <br /> paymentMethod: %s <br /> success: %s %s %s', $type, $eventCode, $pspReference, $paymentMethod, $success, $klarnaReservationNumberText, $boletoPaidAmountText);
break;
}
$order->addStatusHistoryComment($comment, $status);
$order->save();
}