本文整理匯總了PHP中Comments::getAllByCriteria方法的典型用法代碼示例。如果您正苦於以下問題:PHP Comments::getAllByCriteria方法的具體用法?PHP Comments::getAllByCriteria怎麽用?PHP Comments::getAllByCriteria使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Comments
的用法示例。
在下文中一共展示了Comments::getAllByCriteria方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getComments
public function getComments()
{
$html = '';
$comments = Comments::getAllByCriteria('entityName = ? AND type = ? AND entityId = ?', array('PurchaseOrder', Comments::TYPE_PURCHASING, $this->order->getId()), true, 1, 5, array('comm.id' => 'desc'));
if (count($comments) === 0) {
return '';
}
foreach ($comments as $comment) {
$html .= '<div style="max-width: 670px; word-wrap: break-word; font-weight: bold; color: brown;">' . $comment->getComments() . '</div>';
}
return $html;
}
示例2: _getComments
/**
* Getting the comments for an entity
*
* @param array $params
*
* @return string The json string
*/
private function _getComments(array $params)
{
if (!isset($params['entityId']) || !isset($params['entity']) || ($entityId = trim($params['entityId'])) === '' || ($entity = trim($params['entity'])) === '') {
throw new Exception('SYSTEM ERROR: INCOMPLETE DATA PROVIDED');
}
$pageSize = isset($params['pageSize']) && ($pageSize = trim($params['pageSize'])) !== '' ? $pageSize : DaoQuery::DEFAUTL_PAGE_SIZE;
$pageNo = isset($params['pageNo']) && ($pageNo = trim($params['pageNo'])) !== '' ? $pageNo : 1;
$orderBy = isset($params['orderBy']) ? $params['orderBy'] : array('created' => 'desc');
$where = 'entityName = ? and entityId = ?';
$sqlParams = array($entity, $entityId);
if (isset($params['type']) && ($commentType = trim($params['type'])) !== '') {
$where .= 'and type = ?';
$sqlParams[] = trim($commentType);
}
$returnArray = json_encode(array());
$stats = array();
$commentsArray = Comments::getAllByCriteria($where, $sqlParams, true, $pageNo, $pageSize, $orderBy, $stats);
$results = array();
$results['items'] = array_map(create_function('$a', 'return $a->getJson();'), $commentsArray);
$results['pageStats'] = $stats;
return $results;
}
示例3: _getData
protected static function _getData()
{
if (count(self::$_dateRange) === 0) {
$yesterdayLocal = new UDate('now', 'Australia/Melbourne');
$yesterdayLocal->modify('-1 day');
$fromDate = new UDate($yesterdayLocal->format('Y-m-d') . ' 00:00:00', 'Australia/Melbourne');
$fromDate->setTimeZone('UTC');
$toDate = new UDate($yesterdayLocal->format('Y-m-d') . ' 23:59:59', 'Australia/Melbourne');
$toDate->setTimeZone('UTC');
} else {
$fromDate = self::$_dateRange['start'];
$toDate = self::$_dateRange['end'];
}
$dataType = 'created';
$items = Payment::getAllByCriteria($dataType . ' >= :fromDate and ' . $dataType . ' < :toDate', array('fromDate' => trim($fromDate), 'toDate' => trim($toDate)));
$now = new UDate();
$now->setTimeZone('Australia/Melbourne');
$return = array();
foreach ($items as $item) {
$return[] = array('Type' => $item->getOrder() instanceof Order ? 'Payment' : 'Credit', 'InvNo' => $item->getOrder() instanceof Order ? trim($item->getOrder()->getInvNo()) === '' ? '' : $item->getOrder()->getInvNo() : '', 'Payment Date' => $item->getPaymentDate()->setTimeZone('Australia/Melbourne')->format('Y-m-d'), 'Customer Name' => $item->getOrder() instanceof Order ? $item->getOrder()->getCustomer() instanceof Customer ? $item->getOrder()->getCustomer()->getName() : '' : '', 'Order No.' => $item->getOrder() instanceof Order ? $item->getOrder()->getOrderNo() : '', 'CreditNote No' => $item->getCreditNote() instanceof CreditNote ? $item->getCreditNote()->getCreditNoteNo() : '', 'Processed Date' => trim($item->getCreated()->setTimeZone('Australia/Melbourne')), 'Processed By' => $item->getCreatedBy() instanceof UserAccount ? $item->getCreatedBy()->getPerson()->getFullName() : '', 'Method' => $item->getMethod() instanceof PaymentMethod ? trim($item->getMethod()->getName()) : '', 'Amount' => StringUtilsAbstract::getCurrency($item->getCreditNote() instanceof CreditNote ? 0 - $item->getValue() : $item->getValue()), 'Comments' => trim(implode(',', array_map(create_function('$a', 'return $a->getComments();'), Comments::getAllByCriteria('entityName = ? and entityId = ?', array(get_class($item), $item->getId()))))));
}
return $return;
}
示例4: getComments
public function getComments()
{
$comments = Comments::getAllByCriteria('entityId = ? and entityName = ? and type = ?', array($this->order->getId(), get_class($this->order), Comments::TYPE_SALES), true, 1, 1, array('id' => 'desc'));
return count($comments) === 0 ? '' : $comments[0]->getComments();
}
示例5: getOrderItems
/**
* Getting the orders
*
* @param unknown $sender
* @param unknown $param
* @throws Exception
*
*/
public function getOrderItems($sender, $param)
{
$results = $errors = array();
try {
if (!isset($param->CallbackParameter->searchCriteria) || count($serachCriteria = json_decode(json_encode($param->CallbackParameter->searchCriteria), true)) === 0) {
throw new Exception('System Error: search criteria not provided!');
}
$pageNo = 1;
$pageSize = DaoQuery::DEFAUTL_PAGE_SIZE;
if (isset($param->CallbackParameter->pagination)) {
$pageNo = $param->CallbackParameter->pagination->pageNo;
$pageSize = $param->CallbackParameter->pagination->pageSize;
}
$noSearch = true;
$where = array(1);
$params = array();
foreach ($serachCriteria as $field => $value) {
if (is_array($value) && count($value) === 0 || is_string($value) && ($value = trim($value)) === '') {
continue;
}
OrderItem::getQuery()->eagerLoad("OrderItem.order", 'inner join', 'ord', 'ord.id = ord_item.orderId');
switch ($field) {
case 'ord.orderNo':
case 'ord.invNo':
$where[] = $field . " like ? ";
$params[] = $value . '%';
break;
case 'ord_item.isOrdered':
$where[] = $field . " = ? ";
$params[] = $value;
break;
case 'ord_item.eta.from':
$where[] = 'ord_item.eta >= ?';
$params[] = $value;
break;
case 'ord_item.eta.to':
$where[] = 'ord_item.eta <= ?';
$params[] = $value;
break;
}
$noSearch = false;
}
if ($noSearch === true) {
throw new Exception("Nothing to search!");
}
$stats = array();
$orderItems = OrderItem::getAllByCriteria(implode(' AND ', $where), $params, true, $pageNo, $pageSize, array('ord_item.eta' => 'asc', 'ord.orderNo' => 'asc'), $stats);
$results['pageStats'] = $stats;
$results['items'] = array();
foreach ($orderItems as $item) {
$orderItemArray = $item->getJson();
$comments = Comments::getAllByCriteria('entityName = ? and entityId = ?', array('OrderItem', $item->getId()), true, null, DaoQuery::DEFAUTL_PAGE_SIZE, array('created' => 'desc'));
$orderItemArray['comments'] = array_map(create_function('$a', 'return $a->getJson();'), $comments);
$results['items'][] = $orderItemArray;
}
} catch (Exception $ex) {
$errors[] = $ex->getMessage();
}
$param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
}
示例6: getComment
/**
* Getting the comments for this entity
*
* @param string $type
* @param string $pageNo
* @param int $pageSize
* @param array $orderBy
*
* @return Ambigous <multitype:, multitype:BaseEntityAbstract >
*/
public function getComment($type = null, $pageNo = null, $pageSize = DaoQuery::DEFAUTL_PAGE_SIZE, $orderBy = array(), &$pageStats = array())
{
if (count($orderBy) === 0) {
$orderBy = array('comm.id' => 'desc');
}
$where = 'entityName = ? and entityId = ?';
$params = array(get_class($this), $this->getId());
if (($type = trim($type)) !== '') {
$where .= ' AND type = ?';
$params[] = $type;
}
$stats = array();
$results = Comments::getAllByCriteria($where, $params, true, $pageNo, $pageSize, $orderBy, $stats);
return $results;
}