本文整理汇总了PHP中Document::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::model方法的具体用法?PHP Document::model怎么用?PHP Document::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionType
public function actionType($id)
{
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->condition = 'status = 1 AND doc_type_id =' . $id;
$criteria->order = 'sort_order ASC ,last_update DESC';
$model = Document::model()->findAll($criteria);
$type = DocumentType::model()->findByPK($id);
$this->render('index', array('model' => $model, 'type' => $type));
}
示例2: actionView
public function actionView()
{
$tid = isset($_GET['tid']) ? $_GET['tid'] : NULL;
$lay = isset($_GET['topid']) ? $_GET['topid'] : NULL;
$did = isset($_GET['did']) ? $_GET['did'] : NULL;
$title = isset($_GET['title']) ? $_GET['title'] : NULL;
$id = isset($tid) ? $tid : $did;
$islink = isset($_GET['islink']) ? TRUE : FALSE;
if ($islink) {
$dataProvider = Document::model()->findByPk($id);
} else {
$dataProvider = Document::model()->findByAttributes(array('did' => $id));
}
$this->render('view', array('model' => $dataProvider, 'lay' => $lay));
}
示例3: loadModel
public function loadModel()
{
$tid = $_GET['tid'];
$this->islink = $_GET['islink'];
$criteria = new CDbCriteria(array('order' => 'did DESC'));
if ($this->islink) {
$this->_model = DocumentContent::model()->findByAttributes(array('did' => $_GET['tid']));
if ($this->_model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
} else {
$this->_model = Document::model()->findAllByAttributes(array('tid' => $_GET['tid']), $criteria);
}
return $this->_model;
}
示例4: actionIndex
public function actionIndex($alias = NULL)
{
if ($alias != NULL) {
$cdbDocument = new CDbCriteria();
$cdbDocument->condition = 'alias = "' . $alias . '"';
$modelDocument = Document::model()->find($cdbDocument);
if ($modelDocument === NULL) {
throw new CHttpException(404, 'Trang bạn yêu cầu không tồn tại');
}
//cac tin khac de hien thi phan tin tuc
$detail_more = new CDbCriteria();
$detail_more->order = 'id DESC';
$detail_more_num = $modelDocument->id;
$detail_more->condition = 'id NOT IN (' . $detail_more_num . ') ';
$dataProviderMore = new CActiveDataProvider('Document', array('criteria' => $detail_more, 'pagination' => array('pageSize' => 4)));
$this->render('detail', array('model' => $modelDocument, 'dataProviderMore' => $dataProviderMore));
} else {
$dataProvider = new CActiveDataProvider('Document', array('criteria' => array('order' => 'datecreate DESC'), 'pagination' => array('pageSize' => 3)));
$this->render('index', array('dataProvider' => $dataProvider));
}
}
示例5: searchByCondition
public function searchByCondition($txt, $cnt = NULL, $pagination = 1)
{
$criteria = new CDbCriteria();
if (!empty($txt)) {
$criteria->addSearchCondition('t.name', $txt, true, 'OR', 'LIKE');
$criteria->addSearchCondition('t.description', $txt, true, 'OR', 'LIKE');
}
$count = Document::model()->count($criteria);
if (!empty($cnt)) {
return $count;
}
if ($pagination != 1) {
$result = Document::model()->findAll($criteria);
return $result;
}
$pages = new CPagination($count);
// results per page
$pages->pageSize = Yii::app()->params['limit'];
$pages->applyLimit($criteria);
$result = Document::model()->findAll($criteria);
return array('models' => $result, 'pages' => $pages);
}
示例6: CalculateReservedInventory
/**
* Calculates pending order qty to count against available
* inventory by searching for Requested or Awaiting Processing orders
* Because we have our cart table and our documents table, we have to get both numbers
*/
public function CalculateReservedInventory()
{
//Pending orders not yet converted to Invoice
$intReservedA = $this->getDbConnection()->createCommand("SELECT SUM(qty) FROM " . CartItem::model()->tableName() . " AS a\n\t\t\t\t\tLEFT JOIN " . Cart::model()->tableName() . " AS b ON a.cart_id=b.id\n\t\t\t\t\tLEFT JOIN " . Document::model()->tableName() . " AS c ON b.document_id=c.id\n\t\t\t\t\tWHERE\n\t\t\t\t\ta.product_id=" . $this->id . " AND b.cart_type=" . CartType::order . "\n\t\t\t\t\tAND (b.status='" . OrderStatus::Requested . "' OR b.status='" . OrderStatus::AwaitingProcessing . "'\n\t\t\t\t\t\tOR b.status='" . OrderStatus::Downloaded . "')\n\t\t\t\t\tAND (c.status IS NULL OR c.status='" . OrderStatus::Requested . "');")->queryScalar();
if (empty($intReservedA)) {
$intReservedA = 0;
}
//Unattached orders (made independently in Lightspeed)
$intReservedB = $this->getDbConnection()->createCommand("SELECT SUM(qty) from " . DocumentItem::model()->tableName() . " AS a\n\t\t\t\t\tLEFT JOIN " . Document::model()->tableName() . " AS b ON a.document_id=b.id\n\t\t\t\t\tWHERE\n\t\t\t\t\ta.product_id=" . $this->id . " AND b.order_type=" . CartType::order . "\n\t\t\t\t\tAND cart_id IS NULL AND left(order_str,3)='WO-' AND (b.status='" . OrderStatus::Requested . "');")->queryScalar();
if (empty($intReservedB)) {
$intReservedB = 0;
}
return $intReservedA + $intReservedB;
}
示例7: getN
public static function getN()
{
return Document::model()->count();
}
示例8: actionView
public function actionView()
{
$tid = isset($_GET['tid']) ? $_GET['tid'] : NULL;
$did = isset($_GET['did']) ? $_GET['did'] : NULL;
$title = isset($_GET['title']) ? $_GET['title'] : NULL;
$id = isset($tid) ? $tid : $did;
$model = new Document();
$criteria = new CDbCriteria();
$criteria->condition = 'tid=:id';
$criteria->params = array(':id' => $id);
$criteria->order = 'addtime DESC';
$total = $model->count($criteria);
$pages = new CPagination($total);
$pages->pageSize = 5;
$pages->applyLimit($criteria);
$list = $model->with('hm_dc_did')->findAll($criteria);
$dataProvider = Document::model()->findByAttributes(array('did' => $id));
$this->render('view', array('list' => $list, 'pages' => $pages, 'model' => $dataProvider));
}
示例9: document_flush
/**
* Document Flush
*
* @param string $passkey
* @return string
*/
public function document_flush($passkey)
{
if (!$this->check_passkey($passkey)) {
return self::FAIL_AUTH;
}
if (_xls_get_conf('DEBUG_RESET', 0) == 1) {
Yii::log('Skipped document flush operation due to DEBUG mode', CLogger::LEVEL_WARNING, 'application.' . __CLASS__ . "." . __FUNCTION__);
return self::OK;
}
try {
SroRepair::model()->deleteAll();
SroItem::model()->deleteAll();
Sro::model()->deleteAll();
Cart::model()->updateAll(array('document_id' => null));
//We need to make Document items for anything not Invoiced manual to roll back
$objCarts = Document::model()->findAll("order_type = :type AND (status=:status1 OR status=:status2 OR status=:status3)", array(':type' => CartType::order, ':status1' => OrderStatus::Requested, ':status2' => OrderStatus::Processed, ':status3' => OrderStatus::PartiallyReceived));
foreach ($objCarts as $objCart) {
foreach ($objCart->documentItems as $item) {
$item->qty = 0;
$item->save();
$item->product->SetAvailableInventory();
$item->delete();
}
$objCart->delete();
}
//Then delete everytihing else
DocumentItem::model()->deleteAll();
Document::model()->deleteAll();
Yii::app()->db->createCommand("alter table " . Document::model()->tableName() . " auto_increment=1;")->execute();
Yii::app()->db->createCommand("alter table " . DocumentItem::model()->tableName() . " auto_increment=1;")->execute();
Yii::app()->db->createCommand("alter table " . Sro::model()->tableName() . " auto_increment=1;")->execute();
Yii::app()->db->createCommand("alter table " . SroItem::model()->tableName() . " auto_increment=1;")->execute();
Yii::app()->db->createCommand("alter table " . SroRepair::model()->tableName() . " auto_increment=1;")->execute();
//We shouldn't have anything in the cart table that's not an original order, so remove the following if they exist
//ToDo: this shouldn't be in production because we will have removed Quote lines from _cart during install
$objCarts = Cart::model()->findAllByAttributes(array('cart_type' => CartType::quote));
foreach ($objCarts as $objCart) {
foreach ($objCart->cartItems as $item) {
$item->delete();
}
$objCart->delete();
}
//ToDo: this shouldn't be in production because we will have removed SRO lines from _cart during install
$objCarts = Cart::model()->findAllByAttributes(array('cart_type' => CartType::sro));
foreach ($objCarts as $objCart) {
foreach ($objCart->cartItems as $item) {
$item->delete();
}
$objCart->delete();
}
//ToDo: this shouldn't be in production because we will have removed O- from _cart during install
//Delete anything here that's just a pure Order from LS from our Cart Table
$objCarts = Cart::model()->findAll("cart_type = :type and id_str LIKE 'O-%'", array(':type' => CartType::order));
foreach ($objCarts as $objCart) {
foreach ($objCart->cartItems as $item) {
$item->delete();
}
$objCart->delete();
}
//Delete any Web Orders that have been reuploaded from Lightspeed already
$objCarts = Cart::model()->findAll("cart_type = :type AND status<>:status1 AND status<>:status2 AND status<>:status3", array(':type' => CartType::order, ':status1' => OrderStatus::AwaitingPayment, ':status2' => OrderStatus::AwaitingProcessing, ':status3' => OrderStatus::Downloaded));
foreach ($objCarts as $objCart) {
foreach ($objCart->cartItems as $item) {
$item->delete();
}
$objCart->delete();
}
//Delete any carts older than our timeout that don't have a customer ID attached (since those can always be restored)
Cart::GarbageCollect();
} catch (Exception $e) {
Yii::log('SOAP ERROR : In flushing document tables ' . $e, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
return self::UNKNOWN_ERROR;
}
return self::OK;
}
示例10: actionLoad
/**
* Load a Session
*/
public function actionLoad($sessionHash, $documentID = null)
{
$session = Session::model()->find('hash=:signature', [':signature' => $sessionHash]);
/* @var $session Session */
$documents = [];
if ($session) {
if ($documentID) {
$document = Document::model()->findByAttributes(['sessionID' => $session->ID, 'ID' => $documentID]);
if ($document) {
$documents[] = $document;
}
} else {
$documents = $session->documents;
}
}
$this->sendResponse(200, CJSON::encode(['sessionID' => $session->ID, 'documents' => $documents]), 'application/json');
}
示例11: count
if ($addQuestion) {
$url = $app->createUrl('question/answer', ['id' => $addQuestion->q_id]);
}
?>
<style>
.newSearch {
right: -150px;
}
</style>
<ul class="newMenu registered">
<li class=""><a href="/site/jurist/">Наши юристы</a></li>
<li class="">
<a href="/document/MyDocument/">Мои документы в
работе( <?php
echo count(Document::model()->findAllByAttributes(['status' => 1, 'user_id' => $jurist->id]));
?>
)
</a>
</li>
<!--<li class="">
<a href="/requestCall/myPhones/">Мои звонки в
работе( <? /*= count(RequestCall::model()->findAllByAttributes(['status' => 1, 'jurist_id' => $jurist->id])) */ ?>
)
</a>
</li>-->
<li class="">
<a style="<?php
echo $addQuestion ? 'background-color: rgba(163, 9, 15, 0.79)' : null;
?>
"
示例12: 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 = Document::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例13: model
/**
* Returns the static model of the specified AR class.
* @return User the static model class
*/
public static function model($className = __CLASS__)
{
return parent::model($className);
}
示例14: LoadByIdStr
/**
* Load Cart by the Id String (i.e. WO- number)
* @param $strIdStr
* @return array|CActiveRecord|mixed|null
*/
public static function LoadByIdStr($strIdStr)
{
return Document::model()->findByAttributes(array('order_str' => $strIdStr));
}
示例15: actionView
public function actionView($id)
{
$model = Document::model()->findByPk($id);
$this->render('view', ['model' => $model]);
}