本文整理汇总了PHP中unknown_type::save方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown_type::save方法的具体用法?PHP unknown_type::save怎么用?PHP unknown_type::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown_type
的用法示例。
在下文中一共展示了unknown_type::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLesson
/**
* 添加一个lesson
* @param unknown_type $lesson
*/
public function addLesson($lesson)
{
$owner = $this->getOwner();
$lesson->userId = Yii::app()->user->id;
$lesson->courseId = $owner->id;
$lesson->addTime = time();
//处理外链类型的视频
if ($lesson->mediaSource && $lesson->mediaSource != "self" && $lesson->mediaSource != "cloud" && $lesson->mediaType != "text") {
if (strpos($lesson->mediaUri, 'http://') !== 0) {
$lesson->mediaUri = 'http://' . $lesson->mediaUri;
}
if (strpos($lesson->mediaUri, '.swf') === false) {
Yii::import('ext.videolink.VideoLink');
$video = new VideoLink();
$result = $video->parse($lesson->mediaUri);
if ($result) {
$lesson->mediaUri = $result['swf'];
$lesson->mediaSource = $result['source'];
$lesson->mediaName = $result['title'];
$lesson->mediaType = "video";
}
}
}
if (!$lesson->title) {
$lesson->title = $lesson->mediaName;
}
$lesson->status = Lesson::STATUS_HIDDEN;
return $lesson->save();
}
示例2: updateOneToManyArray
/**
* Assuming there exists an activerecord array
*
* @param unknown_type $arObject - the user object to act on (ie. $user )
* @param unknown_type $collectionName - the name of the collection within user object (ie. userprofileecontact)
* @param unknown_type $collectionClassName - the name of the class for the collection (ie. Userprofileecontact)
* @param unknown_type $itemCount - Number of items available within request
* @param unknown_type $arryUpdateFields - the fields to search for ( searches for field.# )
* @param unknown_type $req - the request with all the fields for us
* @return unknown true - either it worked or it there was nothing to do, false if it fails.
*/
public function updateOneToManyArray($arObject, $collectionName, $collectionClassName, $itemCount, $arryUpdateFields, $req)
{
// Loop once for each array item to be added
// build up information as records to persist
$arryRecords = array();
for ($index = 1; $index < $itemCount + 1; $index++) {
$arryUpdates = array();
//print("Pass $index\n");
foreach ($arryUpdateFields as $fieldName) {
$indexedFieldname = $fieldName . $index;
$indexedValue = $req[$indexedFieldname];
$arryUpdates[$fieldName] = $indexedValue;
}
// Don't add empties
if (!empty($arryUpdates) && strlen($arryUpdates[$arryUpdateFields[0]])) {
$arryUpdates['user_id'] = $this->uid;
$arryRecords[] = $arryUpdates;
}
}
// print("Now Writting <p>");
// var_dump($arryRecords);
// Now file $arryRecords in the database
// Delete all existing associations
$colClass = new $collectionClassName();
$colClass->delete_all("user_id=" . $this->uid);
if (!empty($arryRecords)) {
//create and add new items
$collections = array();
foreach ($arryRecords as $record) {
$collections[] = new $collectionClassName($record);
}
$arObject->{$collectionName} = $collections;
return $arObject->save();
}
return true;
}
示例3: quota_image_refresh
/**
* checks to see if the filesize is set and sets it if not
* @param unknown_type $image
* @return object
*/
function quota_image_refresh($image)
{
$image->set('filesize', filesize($image->localpath));
$image->save();
return $image;
}
示例4: _updateInvoices
/**
* Set the invoice status to "Paid" after a successful payment
*
* @param unknown_type $order
*/
private function _updateInvoices($order, $message)
{
$invoices = $order->getInvoiceCollection();
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
$payment = $order->getPayment();
$transaction;
$session = Mage::getSingleton('checkout/session');
$szNewCrossReference;
$transactionId = $payment->getLastTransId();
$transaction = $payment->getTransaction($transactionId);
$transactionType = $transaction->getTxnType();
if ($session->getNewCrossReference()) {
$szNewCrossReference = $session->getNewCrossReference();
$value = $transaction->setTxnId($szNewCrossReference);
$transaction->save();
$payment->setLastTransId($szNewCrossReference);
$session->setNewCrossReference(null);
}
foreach ($invoices as $invoice) {
// set the invoice state to be "Paid"
$invoice->pay()->save();
}
// add a comment to the order comments
if ($transactionType == 'authorization') {
$order->setState($state, 'csv_preauth', $message, true);
} else {
if ($transactionType == 'capture') {
$order->setState($state, 'csv_paid', $message, true);
} else {
Mage::throwException('invalid transaction type [' . $transactionType . '] for invoice updating');
}
}
$order->save();
}