当前位置: 首页>>代码示例>>PHP>>正文


PHP Actions::model方法代码示例

本文整理汇总了PHP中Actions::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Actions::model方法的具体用法?PHP Actions::model怎么用?PHP Actions::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Actions的用法示例。


在下文中一共展示了Actions::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderAttribute

 public function renderAttribute($attr, $makeLinks = true, $textOnly = true, $encode = true)
 {
     if ($attr === 'text') {
         $action = Actions::model();
         $action->actionDescription = $this->{$attr};
         return $action->renderAttribute('actionDescription', $makeLinks, $textOnly, $encode);
     }
 }
开发者ID:shayanyi,项目名称:CRM,代码行数:8,代码来源:ActionText.php

示例2: run

 /**
  * Creates the widget. 
  */
 public function run()
 {
     list($assignedToCondition, $params) = Actions::model()->getAssignedToCondition();
     $total = Yii::app()->db->createCommand("\n            select count(*)\n            from x2_actions\n            where {$assignedToCondition} and (type='' or type is null)\n        ")->queryScalar($params);
     $incomplete = Yii::app()->db->createCommand("\n            select count(*)\n            from x2_actions\n            where {$assignedToCondition} and (type='' or type is null) and complete='No'\n        ")->queryScalar($params);
     $overdue = Actions::model()->countByAttributes(array('assignedTo' => Yii::app()->user->getName(), 'complete' => 'No'), 'dueDate < ' . time() . ' AND (type="" OR type IS NULL)');
     $complete = Actions::model()->countByAttributes(array('completedBy' => Yii::app()->user->getName(), 'complete' => 'Yes'), 'type="" OR type IS NULL');
     $this->render('actionMenu', array('total' => $total, 'unfinished' => $incomplete, 'overdue' => $overdue, 'complete' => $complete));
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:12,代码来源:ActionMenu.php

示例3: run

 public function run()
 {
     $total = Actions::model()->findAllByAttributes(array('assignedTo' => Yii::app()->user->getName(), 'type' => null));
     $total = count($total);
     $temp = Actions::model()->findAllByAttributes(array('assignedTo' => Yii::app()->user->getName(), 'complete' => 'No', 'type' => null));
     $unfinished = count($temp);
     $overdue = 0;
     foreach ($temp as $action) {
         if ($action->dueDate < time()) {
             $overdue++;
         }
     }
     $complete = Actions::model()->findAllByAttributes(array('completedBy' => Yii::app()->user->getName(), 'complete' => 'Yes', 'type' => null));
     $complete = count($complete);
     $this->render('actionMenu', array('total' => $total, 'unfinished' => $unfinished, 'overdue' => $overdue, 'complete' => $complete));
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:16,代码来源:ActionMenu.php

示例4: assertActionCreated

 public function assertActionCreated($type, $message = null)
 {
     $action = Actions::model()->findBySql("SELECT * FROM x2_actions WHERE type='{$type}' ORDER BY createDate DESC,id DESC LIMIT 1");
     $this->assertTrue((bool) $action, "Failed asserting that an action was created. {$type}");
     $associatedModel = X2Model::getAssociationModel($action->associationType, $action->associationId);
     // Test that the models are identical:
     $this->eml->targetModel->refresh();
     foreach (array('myModelName', 'id', 'name', 'lastUpdated', 'createDate', 'assignedTo', 'status') as $property) {
         if ($this->eml->targetModel->hasProperty($property) && $associatedModel->hasProperty($property)) {
             $this->assertEquals($this->eml->targetModel->{$property}, $associatedModel->{$property}, "Failed asserting that an action's associated model record was the same, property: {$property}. {$message}");
         }
     }
     // Assert that the username fields are set properly:
     foreach (array('assignedTo', 'completedBy') as $attr) {
         $this->assertEquals('testuser', $action->assignedTo, "Failed asserting that {$attr} was set properly on the action record. {$message}");
     }
 }
开发者ID:shuvro35,项目名称:X2CRM,代码行数:17,代码来源:InlineEmailTest.php

示例5: actionWhatsNew

 public function actionWhatsNew()
 {
     if (!Yii::app()->user->isGuest) {
         $user = User::model()->findByPk(Yii::app()->user->getId());
         $lastLogin = $user->lastLogin;
         $contacts = Contacts::model()->findAll("lastUpdated > {$lastLogin} ORDER BY lastUpdated DESC LIMIT 50");
         $actions = Actions::model()->findAll("lastUpdated > {$lastLogin} AND (assignedTo='" . Yii::app()->user->getName() . "' OR assignedTo='Anyone') ORDER BY lastUpdated DESC LIMIT 50");
         $sales = Sales::model()->findAll("lastUpdated > {$lastLogin} ORDER BY lastUpdated DESC LIMIT 50");
         $accounts = Accounts::model()->findAll("lastUpdated > {$lastLogin} ORDER BY lastUpdated DESC LIMIT 50");
         $arr = array_merge($contacts, $actions, $sales, $accounts);
         $records = Record::convert($arr);
         $dataProvider = new CArrayDataProvider($records, array('id' => 'id', 'pagination' => array('pageSize' => ProfileChild::getResultsPerPage()), 'sort' => array('attributes' => array('lastUpdated', 'name'))));
         $this->render('whatsNew', array('records' => $records, 'dataProvider' => $dataProvider));
     } else {
         $this->redirect('login');
     }
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:17,代码来源:SiteController.php

示例6: testMigration

 public function testMigration()
 {
     $model = $this->contacts('contact935');
     $workflowActions = Actions::model()->findAllByAttributes(array('associationType' => 'contacts', 'associationId' => $model->id, 'type' => 'workflow'));
     $this->assertEquals(4, count($workflowActions));
     $stage1 = $this->workflowStages('stage1');
     $stage1Action = Actions::model()->findByAttributes(array('associationType' => 'contacts', 'associationId' => $model->id, 'type' => 'workflow', 'workflowId' => 2, 'stageNumber' => 1));
     $this->assertInstanceOf('Actions', $stage1Action);
     $this->assertEquals($stage1->workflowId, $stage1Action->workflowId);
     $this->assertEquals($stage1->stageNumber, $stage1Action->stageNumber);
     //Confirm that saving an action with non-existent stageNumber is okay
     $badAction = new Actions();
     $badAction->type = 'workflow';
     $badAction->workflowId = 2;
     $badAction->stageNumber = -1;
     $badAction->associationType = 'contacts';
     $badAction->associationId = $model->id;
     $this->assertSaves($badAction);
     //Confirm that saving an action with non-existent workflowId is okay
     $badAction->stageNumber = 1;
     $badAction->workflowId = -1;
     $this->assertSaves($badAction);
     //Confirm that saving an action with non-existent workflowId and stageNumber is okay
     $badAction->stageNumber = -1;
     $this->assertSaves($badAction);
     //Confirm that saving duplicate workflow stages is okay
     $badAction2 = new Actions();
     $badAction2->type = 'workflow';
     $badAction2->workflowId = -1;
     $badAction2->stageNumber = -1;
     $badAction2->associationType = 'contacts';
     $badAction2->associationId = $model->id;
     $this->assertSaves($badAction2);
     //Non-duplicate action to confirm deletion of actions with bad workflowId
     $badAction3 = new Actions();
     $badAction3->type = 'workflow';
     $badAction3->workflowId = -99;
     $badAction3->stageNumber = 1;
     $badAction3->associationType = 'contacts';
     $badAction3->associationId = $model->id;
     $this->assertSaves($badAction3);
     //Non-duplicate action to confirm deletion of actions with bad stageNumber
     $badAction4 = new Actions();
     $badAction4->type = 'workflow';
     $badAction4->workflowId = 2;
     $badAction4->stageNumber = -99;
     $badAction4->associationType = 'contacts';
     $badAction4->associationId = $model->id;
     $this->assertSaves($badAction4);
     $workflowActions = Actions::model()->findAllByAttributes(array('associationType' => 'contacts', 'associationId' => $model->id, 'type' => 'workflow'));
     $this->assertEquals(8, count($workflowActions));
     $this->runMigrationScript();
     $workflowActions = Actions::model()->findAllByAttributes(array('associationType' => 'contacts', 'associationId' => $model->id, 'type' => 'workflow'));
     $this->assertEquals(4, count($workflowActions));
     $this->assertNull(Actions::model()->findByPk($badAction->id));
     $this->assertNull(Actions::model()->findByPk($badAction2->id));
     $this->assertNull(Actions::model()->findByPk($badAction3->id));
     $this->assertNull(Actions::model()->findByPk($badAction4->id));
     $stage1ActionPostMigrate = Actions::model()->findByPK($stage1Action->id);
     $this->assertEquals($stage1->workflowId, $stage1ActionPostMigrate->workflowId);
     $this->assertEquals($stage1->id, $stage1ActionPostMigrate->stageNumber);
     //Fails new foreign key constraint
     $badAction5 = new Actions();
     $badAction5->type = 'workflow';
     $badAction5->workflowId = 2;
     $badAction5->stageNumber = -1;
     $badAction5->associationType = 'contacts';
     $badAction5->associationId = $model->id;
     try {
         $badAction5->save();
         $this->assertFalse(true);
     } catch (CDbException $e) {
         $this->assertTrue(true);
     }
     //Fails new unique constraint
     $badAction6 = new Actions();
     $badAction6->type = 'workflow';
     $badAction6->workflowId = 2;
     $badAction6->stageNumber = 5;
     $badAction6->associationType = 'contacts';
     $badAction6->associationId = $model->id;
     try {
         $badAction6->save();
         $this->assertFalse(true);
     } catch (CDbException $e) {
         $this->assertTrue(true);
     }
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:88,代码来源:MigrateWorkflowStages.php

示例7: actionDeleteAction

 public function actionDeleteAction()
 {
     if (isset($_POST['id'])) {
         $id = $_POST['id'];
         $action = Actions::model()->findByPk($id);
         $profile = ProfileChild::model()->findByAttributes(array('username' => $action->assignedTo));
         $profile->deleteGoogleCalendarEvent($action);
         // update action in Google Calendar if user has a Google Calendar
         $action->delete();
     }
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:11,代码来源:DefaultController.php

示例8: calendarActions

 /**
  * Retrieve calendar events for a given user happening between two specified
  * dates.
  * @param string|integer $calendarUser Username or group ID whose calendar
  *  events are to be loaded and returned
  * @param type $start Beginning time range
  * @param type $end End time range
  * @param mixed $includePublic Set to 1 or boolean true to include all
  *  calendar events 
  * @return array An array of action records
  */
 public function calendarActions($calendarUser, $start, $end)
 {
     $filter = explode(',', $this->currentUser->calendarFilter);
     // action types user doesn't want filtered
     $staticAction = Actions::model();
     // View permissions for the viewing user
     $criteria = $staticAction->getAccessCriteria();
     // Assignment condition: all events for the user whose calendar is being viewed:
     $criteria->addCondition('`assignedTo` REGEXP BINARY :unameRegex');
     $permissionsBehavior = Yii::app()->params->modelPermissions;
     $criteria->params[':unameRegex'] = $permissionsBehavior::getUserNameRegex($calendarUser);
     // Action type filters:
     $criteria->addCondition(self::constructFilterClause($filter));
     $criteria->addCondition("`type` IS NULL OR `type`='' OR `type`!='quotes'");
     $criteria->addCondition('(`dueDate` >= :start1 AND `dueDate` <= :end1) ' . 'OR (`completeDate` >= :start2 AND `completeDate` <= :end2)');
     $criteria->params = array_merge($criteria->params, array(':start1' => $start, ':start2' => $start, ':end1' => $end, ':end2' => $end));
     return Actions::model()->findAllWithoutActionText($criteria);
 }
开发者ID:shuvro35,项目名称:X2CRM,代码行数:29,代码来源:CalendarController.php

示例9: testRecordEmailSent

 public function testRecordEmailSent()
 {
     $contact = $this->contacts('testUser');
     $campaign = $this->campaign('testUser');
     $now = time();
     CampaignMailingBehavior::recordEmailSent($campaign, $contact);
     $action = Actions::model()->findByAttributes(array('associationType' => 'contacts', 'associationId' => $contact->id, 'type' => 'email'));
     $this->assertTrue((bool) $action);
     $this->assertTrue(abs($action->completeDate - $now) <= 1);
 }
开发者ID:shayanyi,项目名称:CRM,代码行数:10,代码来源:CampaignMailingBehaviorTest.php

示例10: assertEmailOpenAction

 private function assertEmailOpenAction($model)
 {
     $action = Actions::model()->findByAttributes(array('associationType' => $model->module, 'associationId' => $model->id, 'type' => 'emailOpened'));
     $this->assertNotNull($action);
     //Make sure the module text is correct in the open text
     $openText = Modules::displayName(false, $model->module) . ' has opened the email sent on';
     $this->assertNotFalse(strpos($action->actionDescription, $openText));
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:8,代码来源:TrackEmailTest.php

示例11: actionDelete

 public function actionDelete($id)
 {
     $model = $this->loadModel($id);
     if (Yii::app()->request->isPostRequest) {
         $event = new Events();
         $event->type = 'record_deleted';
         $event->associationType = $this->modelClass;
         $event->associationId = $model->id;
         $event->text = $model->name;
         $event->user = Yii::app()->user->getName();
         $event->save();
         Actions::model()->deleteAll('associationId=' . $id . ' AND associationType=\'x2Leads\'');
         $this->cleanUpTags($model);
         $model->delete();
     } else {
         throw new CHttpException(400, Yii::t('app', 'Invalid request. Please do not repeat this request again.'));
     }
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect
     // the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
     }
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:23,代码来源:X2LeadsController.php

示例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 $id the ID of the model to be loaded
  * @return Actions the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Actions::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:schur-maksim,项目名称:happymoments.ua,代码行数:15,代码来源:ActionsController.php

示例13: actionDelete_user

 public function actionDelete_user($id)
 {
     if ($user = Users::model()->findByPk($id)) {
         $admin = new Users();
         $admin_id = $admin->getAdminId();
         $new_responsible = $user->parent_id != null ? $user->parent_id : $admin_id;
         Clients::model()->updateAll(array('responsable_id' => $new_responsible, 'creator_id' => $new_responsible), 'responsable_id=' . $id);
         Deals::model()->updateAll(array('responsable_id' => $new_responsible), 'responsable_id=' . $id);
         Actions::model()->updateAll(array('responsable_id' => $new_responsible), 'responsable_id=' . $id);
         $user->delete();
         $this->redirect(array('user_info'));
     }
 }
开发者ID:ArseniyDyupin,项目名称:SimpleCRM2,代码行数:13,代码来源:PageController.php

示例14: rand

            <?php 
    }
    ?>
        <?php 
}
?>
        <span class="photo_by">photo by <a href="">Nesterenko Sergey</a></span>
      </div>
    </div>
    <div class="slider">
      <ul class="slider__wrapper">
        <li class="slider__item"><div class="box"><img src="/img/slide-1.jpg" alt=""></div></li>
      </ul>
    </div>
<?php 
$actions = Actions::model()->findAllBySql('select * from {{actions}} where date_end>=:date_end and picture<>"" order by rand() limit 4', array(':date_end' => date('Y-m-d')));
if (count($actions) > 0) {
    ?>
    <div class="wrapper wrapper--users-promotions">
      <section class="container">
        <div class="container__title-wrapper">
          <h5 class="container__title">АКЦИИ УЧАСТНИКОВ</h5>
        </div>
        <div class="action-blocks-wrapper">
<?php 
    foreach ($actions as $action) {
        $act_user = Users::model()->findByPk($action['uid']);
        $new_price = $action['price'] - round($action['price'] * $action['sale'] / 100);
        ?>

                <a class="action-block" href="/actions/<?php 
开发者ID:schur-maksim,项目名称:happymoments.ua,代码行数:31,代码来源:index.php

示例15: getSearchList

 public function getSearchList()
 {
     $res = array();
     $occ = Occupation::model()->findAll();
     foreach ($occ as $item) {
         $action = Actions::model()->countBySql('select id from {{actions}} where occupation_id="' . $item->id . '" and date_end>="' . date('Y-m-d') . '"');
         if ($action > 0) {
             $res[$item->id] = $item->name;
         }
     }
     $res_list = '';
     foreach ($res as $k => $v) {
         $res_list .= '<option value="' . $k . '">' . $v . '</option>';
     }
     return $res;
 }
开发者ID:schur-maksim,项目名称:happymoments.ua,代码行数:16,代码来源:Actions.php


注:本文中的Actions::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。