本文整理汇总了PHP中x2base::view方法的典型用法代码示例。如果您正苦于以下问题:PHP x2base::view方法的具体用法?PHP x2base::view怎么用?PHP x2base::view使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类x2base
的用法示例。
在下文中一共展示了x2base::view方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$type = 'sales';
$model = $this->loadModel($id);
$model->associatedContacts = Contacts::getContactLinks($model->associatedContacts);
parent::view($model, $type);
}
示例2: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$model = $this->loadModel($id);
$model->assignedTo = User::getUserLinks($model->assignedTo);
$type = 'project';
parent::view($model, $type);
}
示例3: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$type = 'quotes';
$model = $this->loadModel($id);
$model->associatedContacts = Contacts::getContactLinks($model->associatedContacts);
// find associated products and their quantities
$quoteProducts = QuoteProduct::model()->findAllByAttributes(array('quoteId' => $model->id));
$orders = array();
// array of product-quantity pairs
$total = 0;
// total price for the quote
foreach ($quoteProducts as $qp) {
$price = $qp->price * $qp->quantity;
if ($qp->adjustmentType == 'percent') {
$price += $price * ($qp->adjustment / 100);
$qp->adjustment = "{$qp->adjustment}%";
} else {
$price += $qp->adjustment;
}
$orders[] = array('name' => $qp->name, 'id' => $qp->productId, 'unit' => $qp->price, 'quantity' => $qp->quantity, 'adjustment' => $qp->adjustment, 'price' => $price);
$order = end($orders);
$total += $order['price'];
}
$dataProvider = new CArrayDataProvider($orders, array('keyField' => 'name', 'sort' => array('attributes' => array('name', 'unit', 'quantity', 'adjustment', 'price')), 'pagination' => array('pageSize' => false)));
parent::view($model, $type, array('dataProvider' => $dataProvider, 'total' => $total));
}
示例4: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$model = $this->loadModel($id);
$model->assignedTo = User::getUserLinks($model->assignedTo);
$model->associatedContacts = Contacts::getContactLinks($model->associatedContacts);
$type = 'case';
parent::view($model, $type);
}
示例5: actionView
public function actionView($id)
{
if ($id == 0) {
$this->redirect(array('index'));
} else {
$model = X2Calendar::model()->findByPk($id);
parent::view($model, 'calendar');
}
}
示例6: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$model = $this->loadModel($id);
if (!$this->checkPermissions($model, 'view')) {
$this->denied();
}
// add service case to user's recent item list
User::addRecentItem('s', $id, Yii::app()->user->getId());
parent::view($model, 'services');
}
示例7: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$type = 'BugReports';
$model = $this->loadModel($id);
if ($this->checkPermissions($model, 'view')) {
parent::view($model, $type);
} else {
$this->redirect('index');
}
}
示例8: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
* @param null|Opportunity Set by actionConvertLead in the case that conversion fails
*/
public function actionView($id, $opportunity = null)
{
$type = 'x2Leads';
$model = $this->loadModel($id);
if ($this->checkPermissions($model, 'view')) {
// add opportunity to user's recent item list
User::addRecentItem('l', $id, Yii::app()->user->getId());
parent::view($model, $type);
} else {
$this->redirect('index');
}
}
示例9: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$type = 'opportunities';
$model = $this->loadModel($id);
$model->associatedContacts = Contacts::getContactLinks($model->associatedContacts);
if ($this->checkPermissions($model, 'view')) {
// add opportunity to user's recent item list
User::addRecentItem('o', $id, Yii::app()->user->getId());
parent::view($model, $type);
} else {
$this->redirect('index');
}
}
示例10: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$type = 'quotes';
$model = $this->getModel($id);
if (!$this->checkPermissions($model, 'view')) {
$this->denied();
}
$quoteProducts = $model->lineItems;
// add quote to user's recent item list
User::addRecentItem('q', $id, Yii::app()->user->getId());
$contactNameId = Fields::nameAndId($model->associatedContacts);
$contactId = $contactNameId[1];
parent::view($model, $type, array('orders' => $quoteProducts, 'contactId' => $contactId));
}
示例11: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$model = $this->loadModel($id);
if (!parent::checkPermissions($model, 'view')) {
$this->denied();
}
// add account to user's recent item list
User::addRecentItem('a', $id, Yii::app()->user->getId());
if ($model->checkForDuplicates()) {
$this->redirect($this->createUrl('/site/duplicateCheck', array('moduleName' => 'accounts', 'modelName' => 'Accounts', 'id' => $id, 'ref' => 'view')));
} else {
$model->duplicateChecked();
parent::view($model, 'accounts');
}
}
示例12: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$type = 'product';
$model = $this->loadModel($id);
parent::view($model, $type);
}
示例13: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
// $this->layout = '//layouts/column3';
$contact = $this->loadModel($id);
$viewPermissions = $contact->assignedTo == Yii::app()->user->getName() || $contact->visibility == 1 || Yii::app()->user->getName() == 'admin';
/* x2temp */
$groups = GroupToUser::model()->findAllByAttributes(array('userId' => Yii::app()->user->getId()));
$temp = array();
foreach ($groups as $group) {
$temp[] = $group->groupId;
}
if (array_search($contact->assignedTo, $temp) !== false) {
$viewPermissions = true;
}
if ($contact->visibility == '2') {
$user = User::model()->findByAttributes(array('username' => $contact->assignedTo));
$groups = GroupToUser::model()->findAllByAttributes(array('userId' => $user->id));
$tempOne = array();
foreach ($groups as $group) {
$tempOne[] = $group->groupId;
}
$userGroups = GroupToUser::model()->findAllByAttributes(array('userId' => Yii::app()->user->getId()));
$tempTwo = array();
foreach ($userGroups as $userGroup) {
$tempTwo[] = $userGroup->groupId;
}
if (count(array_intersect($tempOne, $tempTwo)) > 0) {
$viewPermissions = true;
}
}
if (is_numeric($contact->assignedTo)) {
$contact->assignedTo = Groups::model()->findByPk($contact->assignedTo)->name;
}
/* end x2temp */
if ($viewPermissions) {
User::addRecentItem('c', $id, Yii::app()->user->getId());
////add contact to user's recent item list
parent::view($contact, 'contacts');
} else {
$this->redirect('index');
}
}
示例14: actionRevisions
/**
* This is a prototype function designed to re-build a record from the changelog.
*
* This method is largely a work in progress though it is functional right
* now as is, it could just use some refactoring and improvements. On the
* "View Changelog" page in the Admin tab there's a link on each Contact
* changelog entry to view the record at that point in the history. Clicking
* that link brings you here.
* @param int $id The ID of the Contact to be viewed
* @param int $timestamp The timestamp to view the Contact at... this should probably be refactored to changelog ID
*/
public function actionRevisions($id, $timestamp)
{
$contact = $this->loadModel($id);
// Find all the changelog entries associated with this Contact after the given
// timestamp. Realistically, this would be more accurate if Changelog ID
// was used instead of the timestamp.
$changes = X2Model::model('Changelog')->findAll('type="Contacts" AND itemId="' . $contact->id . '" AND timestamp > ' . $timestamp . ' ORDER BY timestamp DESC');
// Loop through the changes and apply each one retroactively to the Contact record.
foreach ($changes as $change) {
$fieldName = $change->fieldName;
if ($contact->hasAttribute($fieldName) && $fieldName != 'id') {
$contact->{$fieldName} = $change->oldValue;
}
}
// Set our widget info
if (isset($this->portlets['TimeZone'])) {
$this->portlets['TimeZone']['params']['model'] =& $contact;
}
if ($this->checkPermissions($contact, 'view')) {
if (isset($_COOKIE['vcr-list'])) {
Yii::app()->user->setState('vcr-list', $_COOKIE['vcr-list']);
}
User::addRecentItem('c', $id, Yii::app()->user->getId());
////add contact to user's recent item list
// View the Contact with the data modified to this point
parent::view($contact, 'contacts');
} else {
$this->redirect('index');
}
}
示例15: actionView
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$model = $this->loadModel($id);
$type = 'accounts';
parent::view($model, $type);
}