本文整理汇总了PHP中x2base类的典型用法代码示例。如果您正苦于以下问题:PHP x2base类的具体用法?PHP x2base怎么用?PHP x2base使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了x2base类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
x2base::cleanUpSessions();
// $criteria = new CDbCriteria(array('condition'=>'','distinct'=>true)
// $sessions = Session::model()->findAll($criteria);
// $str = "";
// foreach($sessions as $session) {
// if(time()-$session->lastUpdated<(15*60)) {
// $str.=$session->user.", ";
// }
// }
// if($str!="") {
// $str=substr($str,0,-2);
// }
$onlineUsers = User::getUserLinks(Session::getOnlineUsers());
$this->render('onlineUsers', array('users' => $onlineUsers));
//array(
}
示例2: array
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
* California 95067, USA. or at email address contact@x2engine.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* X2Engine" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by X2Engine".
*****************************************************************************************/
$menuItems = array(array('label' => Yii::t('app', 'Main Menu'), 'url' => array('/mobile/site/home')));
$this->widget('MenuList', array('id' => 'main-menu', 'items' => $menuItems));
?>
<br />
<?php
echo x2base::convertUrls($model->text);
示例3: getText
//.........这里部分代码省略.........
case 'workflow_revert':
$action = X2Model::model('Actions')->findByPk($this->associationId);
if (isset($action)) {
$record = X2Model::model(ucfirst($action->associationType))->findByPk($action->associationId);
if (isset($record)) {
$stages = Workflow::getStages($action->workflowId);
$text = $authorText . Yii::t('app', 'reverted the process stage "{stageName}" for the {modelName} {modelLink}', array('{stageName}' => $stages[$action->stageNumber - 1], '{modelName}' => Events::parseModelName($action->associationType), '{modelLink}' => X2Model::getModelLink($action->associationId, $action->associationType)));
} else {
$text = $authorText . Yii::t('app', "reverted a process stage, but the associated {modelName} was not found.", array('{modelName}' => Events::parseModelName($action->associationType)));
}
} else {
$text = $authorText . Yii::t('app', "reverted a process stage, but the process record could not be found.");
}
break;
case 'feed':
if (Yii::app()->user->getName() == $this->user) {
$author = CHtml::link(Yii::t('app', 'You'), Yii::app()->controller->createAbsoluteUrl('/profile/view', array('id' => Yii::app()->user->getId())), $htmlOptions) . " ";
} else {
$author = User::getUserLinks($this->user);
}
$recipUser = Yii::app()->db->createCommand()->select('username')->from('x2_users')->where('id=:id', array(':id' => $this->associationId))->queryScalar();
$modifier = '';
$recipient = '';
if ($this->user != $recipUser && $this->associationId != 0) {
if (Yii::app()->user->getId() == $this->associationId) {
$recipient = Yii::t('app', 'You');
} else {
$recipient = User::getUserLinks($recipUser);
}
if (!empty($recipient)) {
$modifier = ' » ';
}
}
$text = $author . $modifier . $recipient . ": " . ($truncated ? strip_tags(Formatter::convertLineBreaks(x2base::convertUrls($this->text), true, true), '<a></a>') : $this->text);
break;
case 'email_sent':
if (class_exists($this->associationType)) {
$model = X2Model::model($this->associationType)->findByPk($this->associationId);
if (!empty($model)) {
switch ($this->subtype) {
case 'quote':
$text = $authorText . Yii::t('app', "issued the {transModelName} \"{modelLink}\" via email", array('{transModelName}' => Yii::t('quotes', 'quote'), '{modelLink}' => X2Model::getModelLink($this->associationId, $this->associationType)));
break;
case 'invoice':
$text = $authorText . Yii::t('app', "issued the {transModelName} \"{modelLink}\" via email", array('{transModelName}' => Yii::t('quotes', 'invoice'), '{modelLink}' => X2Model::getModelLink($this->associationId, $this->associationType)));
break;
default:
$text = $authorText . Yii::t('app', "sent an email to the {transModelName} {modelLink}", array('{transModelName}' => Events::parseModelName($this->associationType), '{modelLink}' => X2Model::getModelLink($this->associationId, $this->associationType)));
break;
}
} else {
$deletionEvent = X2Model::model('Events')->findByAttributes(array('type' => 'record_deleted', 'associationType' => $this->associationType, 'associationId' => $this->associationId));
switch ($this->subtype) {
case 'quote':
if (isset($deletionEvent)) {
$text = $authorText . Yii::t('app', "issued a quote by email, but that record has been deleted.");
} else {
$text = $authorText . Yii::t('app', "issued a quote by email, but that record could not be found.");
}
break;
case 'invoice':
if (isset($deletionEvent)) {
$text = $authorText . Yii::t('app', "issued an invoice by email, but that record has been deleted.");
} else {
$text = $authorText . Yii::t('app', "issued an invoice by email, but that record could not be found.");
}
示例4: array
echo CHtml::link('[x]',array('deletePost','id'=>$data->id,'redirect'=>Yii::app()->controller->action->id)); //,array('class'=>'x2-button') ?>
</div>
<?php echo CHtml::link(Yii::t('profile','Reply'),'#',array('onclick'=>"$('#addReply-".$data->id."').toggle();",'class'=>'x2-button float')); ?>
<?php
if($authorRecord->id != $data->associationId && $data->associationId != 0) {
$temp=Profile::model()->findByPk($data->associationId);
$recipient=$temp->fullName;
$modifier=' » ';
} else {
$recipient='';
$modifier='';
}
?>
<?php echo CHtml::link($author,array('profile/view','id'=>$authorRecord->id)).$modifier.CHtml::link($recipient,$data->associationId); ?> <span class="comment-age"><?php echo x2base::timestampAge(date("Y-m-d H:i:s",$data->timestamp)); ?></span><br />
<?php echo x2base::convertLineBreaks($this->convertUrls($data->data)); ?><br />
<?php
if(count($commentDataProvider->getData())>0){
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$commentDataProvider,
'itemView'=>'../social/_view',
'template'=>'{items}'
));
}
echo CHtml::beginForm(
'addComment',
'get',
array(
'style'=>'display:none;',
'id'=>'addReply-'.$data->id,
示例5: array
?>
<div class="view">
<div class="deleteButton">
<?php
$parent = Social::model()->findByPk($data->associationId);
if ($data->user == Yii::app()->user->getName() || $parent->associationId == Yii::app()->user->getId()) {
echo CHtml::link('[x]', array('deletePost', 'id' => $data->id, 'redirect' => Yii::app()->controller->action->id));
}
//,array('class'=>'x2-button')
?>
</div>
<?php
echo CHtml::link($author, array('profile/view', 'id' => $authorRecord->id));
?>
<span class="comment-age"><?php
echo x2base::timestampAge(date("Y-m-d H:i:s", $data->timestamp));
?>
</span><br />
<?php
echo $this->convertUrls(CHtml::encode($data->data));
?>
</div>
<?php
/*
<div class="view">
<div class="deleteButton">
<?php echo CHtml::link('[x]',array('deleteNote','id'=>$data->id)); //,array('class'=>'x2-button') ?>
<?php //echo CHtml::link("<img src='".Yii::app()->request->baseUrl."/images/deleteButton.png' />",array("deleteNote","id"=>$data->id)); ?>
</div>
示例6: attachmentSocialText
/**
* @param string $str
* @param boolean $makeLink
* @param boolean $makeImage
* @return string
*/
public static function attachmentSocialText($str, $makeLink = false, $makeImage = false)
{
// $a = '<a href="/x2merge/index.php/media/16">footer.png</a>';
// echo ,preg_match('/^<a href=".+(media\/[0-9]+)" target="_blank">.+<\/a>$/i',$description
$matches = array();
// die(CHtml::encode($description));
if (preg_match('/^<a href=".+media\\/view\\/([0-9]+)">.+<\\/a>$/i', $str, $matches)) {
if (count($matches) == 2 && is_numeric($matches[1])) {
$media = X2Model::model('Media')->findByPk($matches[1]);
if (isset($media)) {
$str = Yii::t('media', 'File:') . ' ';
return self::getImageText($str, $makeLink, $makeImage, $media);
}
}
} elseif (preg_match('/^<a target="_blank" href="https:\\/\\/drive.google.com\\/file\\/d\\/(.+)">.+<\\/a>$/i', $str, $matches)) {
if (count($matches) == 2) {
$media = X2Model::model('Media')->findByAttributes(array('fileName' => $matches[1]));
if (isset($media)) {
$str = Yii::t('media', 'Google Drive:') . ' ';
return self::getImageText($str, $makeLink, $makeImage, $media);
}
}
}
return x2base::convertUrls($str);
}
示例7: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model = $this->loadModel($id);
$users = User::getNames();
$fields = Fields::model()->findAllByAttributes(array('modelName' => 'Product'));
foreach ($fields as $field) {
if ($field->type == 'link') {
$fieldName = $field->fieldName;
$type = ucfirst($field->linkType);
if (is_numeric($model->{$fieldName}) && $model->{$fieldName} != 0) {
eval("\$lookupModel={$type}::model()->findByPk(" . $model->{$fieldName} . ");");
if (isset($lookupModel)) {
$model->{$fieldName} = $lookupModel->name;
}
}
}
}
if (isset($_POST['Product'])) {
$temp = $model->attributes;
$model->setX2Fields($_POST['Product']);
// generate history
$action = new Actions();
$action->associationType = 'product';
$action->associationId = $model->id;
$action->associationName = $model->name;
$action->assignedTo = Yii::app()->user->getName();
$action->completedBy = Yii::app()->user->getName();
$action->dueDate = time();
$action->completeDate = time();
$action->visibility = 1;
$action->complete = 'Yes';
$action->actionDescription = "Update: {$model->name}\n Type: {$model->type}\n Price: {$model->price}\n Currency: {$model->currency}\n Inventory: {$model->inventory}";
$action->save();
parent::update($model, $temp, '0');
}
$this->render('update', array('model' => $model, 'users' => $users));
}
示例8: actionView
public function actionView($id)
{
if ($id == 0) {
$this->redirect(array('index'));
} else {
$model = X2Calendar::model()->findByPk($id);
parent::view($model, 'calendar');
}
}
示例9: 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');
}
示例10: 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');
}
}
示例11: 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');
}
}
示例12: 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));
}
示例13: 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');
}
}
示例14: behaviors
public function behaviors()
{
return array_merge(parent::behaviors(), array('ImportExportBehavior' => array('class' => 'ImportExportBehavior')));
}
示例15: 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');
}
}