本文整理汇总了PHP中Transfer::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Transfer::model方法的具体用法?PHP Transfer::model怎么用?PHP Transfer::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transfer
的用法示例。
在下文中一共展示了Transfer::model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderContent
protected function renderContent()
{
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$model = GxcHelpers::loadDetailModel('Object', $id);
//We start to implement the checking Permission HERE
$param_content_check = array();
$data_content_check = array();
$param_content_check['type'] = $model->object_type;
$param_content_check['new_content'] = false;
$param_content_check['content_status'] = $model->object_status;
$param_content_check['content_author'] = $model->object_author;
//Get current trans_to of the object
$trans = Transfer::model()->findAll(array('condition' => ' object_id=:obj ', 'params' => array(':obj' => $model->object_id), 'order' => 'transfer_id DESC'));
$param_content_check['check_trans_note'] = false;
if ($trans != null && count($trans) > 0) {
$latest_trans_to = $trans[0];
$param_content_check['trans_type'] = $latest_trans_to->type;
$param_content_check['trans_to'] = $latest_trans_to->to_user_id;
$param_content_check['trans_note'] = $latest_trans_to->note;
}
//Get Types list and type of the Object
$types = GxcHelpers::getAvailableContentType();
$type = (string) $model->object_type;
//Import the Content Type Class
Yii::import('common.content_type.' . $type . '.' . $types[$type]['class']);
$typeClassObj = new $types[$type]['class']();
$content_resources = $typeClassObj->Resources();
//Check if the User has the Permission to update the Content
if (GxcContentPermission::checkUpdatePermission($param_content_check, $data_content_check, $typeClassObj->Permissions())) {
//Convert the object date from timestamp to datetime format
$model->object_date = date('Y-m-d H:i:s', $model->object_date);
//Get available content Status that the Object can be sent to
$content_status = GxcContentPermission::getContentStatus($param_content_check, $data_content_check, $typeClassObj->Permissions());
//If the Object is Pending and being sent to someone, get that person info
if ($model->object_status == ConstantDefine::OBJECT_STATUS_PENDING) {
if ($latest_trans_to->type == ConstantDefine::TRANS_PERSON) {
$send_to_user = User::model()->findbyPk($latest_trans_to->to_user_id);
if ($send_to_user == null) {
$model->person = '';
} else {
$model->person = trim($send_to_user->display_name);
}
}
}
//Unset value for Lang Exclude, Version and Guid when updating
$lang_exclude = array();
$versions = array();
$guid = $model->guid;
// Create new instance Object based on Object Type
$object = new $types[$type]['class']();
$object->person = $model->person;
$object->setAttributes($model->attributes, false);
// Get Extra Info - Object Meta of the Object Type
$object_metas = ObjectMeta::model()->findAll('meta_object_id = :obj ', array(':obj' => $model->object_id));
foreach ($object_metas as $object_meta) {
$key = (string) $object_meta->meta_key;
$object->{$key} = $object_meta->meta_value;
}
// This is not a new Record
$object->isNewRecord = false;
//Set current tags for Object
$object->_oldTags = $object->tags;
$object->scenario = 'updateWithTags';
//Available Terms for this Object Type
$terms = array();
//Selected Terms
$selected_terms = array();
//Get Term Order
$term_orders = ConstantDefine::getTermOrder();
//Get available Taxonomy and Terms for this Object
$available_taxonomy = Taxonomy::model()->findAll(' type = :type AND lang IN (' . $object->lang . ') ', array(':type' => $type));
if ($available_taxonomy) {
foreach ($available_taxonomy as $t) {
$temp = array();
$temp['id'] = $t->taxonomy_id;
$temp['lang'] = $t->lang;
$temp['name'] = $t->name;
$temp['terms'] = array();
$selected_temp = array();
$selected_temp['id'] = $t->taxonomy_id;
$selected_temp['lang'] = $t->lang;
$selected_temp['name'] = $t->name;
$selected_temp['terms'] = array();
//Look for the Term Items belong to this Taxonomy
$list_terms = Term::model()->findAll(array('select' => '*', 'condition' => 'taxonomy_id=:id', 'order' => 't.parent ASC, t.order ASC', 'params' => array(':id' => $t->taxonomy_id)));
if ($list_terms) {
foreach ($list_terms as $term) {
$temp_item['id'] = $term->term_id;
$temp_item['name'] = CHtml::encode($term->name);
$temp_item['parent'] = $term->parent;
$temp['terms']['item_' . $term->term_id] = $temp_item;
}
}
$terms[$t->taxonomy_id] = $temp;
//Look for selected Terms belong to this Taxonomy
$sl_terms = ObjectTerm::model()->findAll(array('select' => '*', 'condition' => 'object_id=:id', 'params' => array(':id' => $object->object_id)));
if ($sl_terms) {
foreach ($sl_terms as $sl_term) {
if (isset($terms[$t->taxonomy_id]['terms']['item_' . $sl_term->term_id])) {
$selected_temp['terms']['item_' . $sl_term->term_id] = $terms[$t->taxonomy_id]['terms']['item_' . $sl_term->term_id];
//.........这里部分代码省略.........
示例2: getAllotments
public function getAllotments()
{
//$applicant = $this->loadModel($id);
$allotments = $this->allotments;
// get all allotments made to this applicant
if (!empty($allotments)) {
// if allotment(s) was made
$cnt = count($allotments);
for ($i = 0; $i < $cnt; $i++) {
//check if it was transferred to anyone else
$criteria = new CDbCriteria(array('condition' => 'allotment_id=:aid', 'order' => 'transfer_date DESC', 'limit' => 1, 'params' => array(':aid' => $allotments[$i]->id)));
$transfer = Transfer::model()->find($criteria);
if ($transfer != null) {
//if transferred set $allotment date and deed_no
if ($transfer->applicant_id === $this->id) {
$allotments[$i]->date = $transfer->transfer_date;
$allotments[$i]->order_no = $transfer->deed_no;
$allotments[$i]->type = 'transfer';
} else {
unset($allotments[$i]);
}
}
}
}
//select allotments from transfers if any made only by transfer
$criteria = new CDbCriteria(array('condition' => 'applicant_id=:aid', 'order' => 'transfer_date DESC', 'limit' => 1, 'params' => array(':aid' => $this->id)));
$transfer = Transfer::model()->find($criteria);
if ($transfer != null) {
//if transferred set $allotment date and deed_no
if ($transfer->applicant_id === $this->id) {
$allotment = $transfer->allotment;
$allotment->applicant_id = $transfer->applicant_id;
$allotment->date = $transfer->transfer_date;
$allotment->order_no = $transfer->deed_no;
$allotment->type = 'transfer';
$allotments[] = $allotment;
}
}
return new CArrayDataProvider($allotments);
}
示例3: getTransferHistory
/**
* Get the history workflow of the Object
* @param type $object
*/
public static function getTransferHistory($model)
{
$trans = Transfer::model()->with('from_user')->findAll(array('condition' => ' object_id=:obj ', 'params' => array(':obj' => $model->object_id), 'order' => 'transfer_id ASC'));
$trans_list = "<ul>";
$trans_list .= "<li>- <b>" . $model->author->display_name . "</b> " . t("cms", "created on") . " <b>" . date('m/d/Y H:i:s', $model->object_modified) . "</b></li>";
//Start to Translate all the Transition
foreach ($trans as $tr) {
if ($tr->type == ConstantDefine::TRANS_STATUS) {
$temp = "<li>- <b>" . $tr->from_user->display_name . "</b> " . t("cms", "changed status to") . " <b>" . self::convertObjectStatus($tr->after_status) . "</b> " . t("cms", "on") . " <b>" . date('m/d/Y H:i:s', $tr->time) . "</b></li>";
}
if ($tr->type == ConstantDefine::TRANS_ROLE) {
$temp = "<li>- <b>" . $tr->from_user->display_name . "</b> " . t("cms", "modified and sent to") . " <b>" . ucfirst($tr->note) . "</b> " . t("cms", "on") . " <b>" . date('m/d/Y H:i:s', $tr->time) . "</b></li>";
}
if ($tr->type == ConstantDefine::TRANS_PERSON) {
$to_user = User::model()->findbyPk($tr->to_user_id);
$name = "";
if ($to_user != null) {
$name = $to_user->display_name;
}
$temp = "<li>- <b>" . $tr->from_user->display_name . "</b> " . t("cms", "modified and sent to") . " <b>" . ucfirst($name) . "</b> " . t("cms", "on") . " <b>" . date('m/d/Y H:i:s', $tr->time) . "</b></li>";
}
$trans_list .= $temp;
}
$trans_list .= '</ul>';
return $trans_list;
}
示例4: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer the ID of the model to be loaded
*/
public function loadModel($id)
{
$model = Transfer::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}