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


PHP Activity::save方法代码示例

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


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

示例1: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($workerunit) {
         //    dd($workerunit);
         // Inherit type, domain and format
         if (empty($workerunit->type) or empty($workerunit->domain) or empty($workerunit->format)) {
             $j = Job::where('_id', $workerunit->job_id)->first();
             $workerunit->type = $j->type;
             $workerunit->domain = $j->domain;
             $workerunit->format = $j->format;
         }
         $workerunit->annotationVector = $workerunit->createAnnotationVector();
         // Activity if not exists
         if (empty($workerunit->activity_id)) {
             try {
                 $activity = new Activity();
                 $activity->label = "Workerunit is saved.";
                 $activity->softwareAgent_id = $workerunit->softwareAgent_id;
                 $activity->save();
                 $workerunit->activity_id = $activity->_id;
                 Log::debug("Saving workerunit {$workerunit->_id} with activity {$workerunit->activity_id}.");
             } catch (Exception $e) {
                 if ($activity) {
                     $activity->forceDelete();
                 }
                 //if($workerunit) $workerunit->forceDelete();
                 throw new Exception('Error saving activity for workerunit.');
             }
         }
     });
 }
开发者ID:harixxy,项目名称:CrowdTruth,代码行数:32,代码来源:Workerunit.php

示例2: logActivity

 function logActivity($action, $body = null)
 {
     $activity = new Activity($this);
     $name = $this->logName();
     $activity->body = "{$action} {$activity->target_class} {$activity->target_id}" . ($name ? ", \"{$name}\"" : "");
     $activity->save();
 }
开发者ID:broofa,项目名称:socipedia,代码行数:7,代码来源:basemodel.php

示例3: store

 /**
  * Store to the database the given entities as entities decendent from the given
  * document.
  * 
  * @param $document Parent document -- Must be a document entity on the database.
  * @param $entities List of entities to be created as decendents from the given document. 
  * 
  * @return multitype:string A status array containing the result status information.
  */
 public function store($parent, $units, $type)
 {
     if (count($units) <= 0 && count($units) >= 10000) {
         // We will have problems processing empty files or more than 10,000 entities
         return ['error' => 'Unable to process files with more than 10,000 lines: ' . $nEnts . 'found'];
     }
     $activity = new \Activity();
     $activity->softwareAgent_id = $this->softwareComponent->_id;
     $activity->save();
     $entities = [];
     foreach ($units as $unit) {
         try {
             $entity = new Unit();
             $entity->project = $parent->project;
             $entity->activity_id = $activity->_id;
             $entity->documentType = $type;
             $entity->parents = [$parent->_id];
             $entity->content = $unit;
             $entity->hash = md5(serialize($entity));
             $entity->save();
             array_push($entities, $entity);
         } catch (Exception $e) {
             foreach ($entities as $en) {
                 $en->forceDelete();
             }
             throw $e;
         }
     }
     \Temp::truncate();
     return ['success' => 'Sentences created successfully'];
 }
开发者ID:crowdtruth,项目名称:crowdtruth,代码行数:40,代码来源:TextSentencePreprocessor.php

示例4: postAddActivity

 public function postAddActivity()
 {
     $company_id = Session::get('company');
     $validator = Validator::make(Input::all(), array('type' => 'required|max:100', 'outcome' => 'required|max:200', 'name' => 'required|max:100', 'date' => 'required'));
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     } else {
         $type = Input::get('type');
         $outcome = Input::get('outcome');
         $name = Input::get('name');
         $date = Input::get('date');
         $activity = new Activity();
         $activity->type = $type;
         $activity->outcome = $outcome;
         $activity->sales_p_name = $name;
         $activity->date = $date;
         $activity->cutomer_id = $company_id;
         $insertedToActivity = $activity->save();
         if ($insertedToActivity) {
             return Redirect::route('dashboard');
         } else {
             return Redirect::route('activityAdd');
         }
     }
 }
开发者ID:nimeshmora,项目名称:CRM-DMA-Recruitment,代码行数:25,代码来源:ActivityController.php

示例5: log

 function log($activity)
 {
     $act = new Activity();
     $act->message = $activity;
     $act->user_id = Auth::user()->id;
     $act->save();
 }
开发者ID:carriercomm,项目名称:saaspanel,代码行数:7,代码来源:Activity.php

示例6: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Activity();
     $model->attributes = $_POST;
     $result = $model->save();
     $this->sendAjaxResponse($model);
 }
开发者ID:pdooley,项目名称:genesis,代码行数:11,代码来源:ActivityController.php

示例7: afterFind

 function afterFind(\Model $model, $results, $primary)
 {
     parent::afterFind($model, $results, $primary);
     if ($model->id) {
         $data = array('model' => $model->alias, 'model_id' => $model->id, 'activity_type' => 'R', 'user_id' => $model->loginUser['id']);
         $activity = new Activity();
         $activity->save($data);
     }
 }
开发者ID:khaled-saiful-islam,项目名称:zen_v1.0,代码行数:9,代码来源:ActivityBehavior.php

示例8: getOldActivity

 protected function getOldActivity($subject, $created)
 {
     $activity = new Activity(['subject_id' => $subject->getKey(), 'subject_type' => get_class($subject), 'user_id' => 1, 'name' => 'created_post']);
     $time = Carbon::createFromTimestamp($created)->toDateTimeString();
     $activity->setCreatedAt($time);
     $activity->setUpdatedAt($time);
     $activity->save();
     return $activity;
 }
开发者ID:kenarkose,项目名称:chronicle,代码行数:9,代码来源:ChronicleTest.php

示例9: log

 public static function log($activity, User $user = null)
 {
     if ($user === null) {
         $user = User::$me;
     }
     $a = new Activity();
     $a->set('user_id', $user->id);
     $a->set('action_date', date("Y-m-d H:i:s"));
     $a->set('activity', $activity);
     $a->save();
     return $a;
 }
开发者ID:JoonasMelin,项目名称:BotQueue,代码行数:12,代码来源:activity.php

示例10: store

 public function store()
 {
     $activity = new Activity();
     $activity->project_id = Auth::user()->curr_project_id;
     $activity->location_id = Input::get('location');
     $activity->name = Input::get('name');
     $activity->description = Input::get('description');
     $activity->agenda = Input::get('agenda');
     $activity->coordination = Input::get('coordination');
     $activity->save();
     Session::flash('message', 'Sukses menambahkan agenda baru');
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:12,代码来源:ActivitiesController.php

示例11: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Activity();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Activity'])) {
         $model->attributes = $_POST['Activity'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->act_id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:JexIboy,项目名称:lis-pglu,代码行数:17,代码来源:ActivityController.php

示例12: store

 public function store()
 {
     $ac = new Activity();
     $ac->user_id = Auth::user()->id;
     $ac->site_id = Input::get('site');
     $ac->problem = Input::get('problem');
     $ac->activity = Input::get('activity');
     $ac->detail_activity = Input::get('dactivity');
     $ac->mulai = Carbon::parse(Input::get('mulai'));
     $ac->selesai = Carbon::parse(Input::get('selesai'));
     $ac->save();
     Session::flash('success', 'Data telah dibuat.');
     return Redirect::to('/' . Auth::user()->role . '/activity');
 }
开发者ID:heruujoko,项目名称:tsel-net-management,代码行数:14,代码来源:ActivityController.php

示例13: TraceIncomingCall

function TraceIncomingCall()
{
    require_once 'include/utils/utils.php';
    global $adb, $current_user;
    global $theme, $app_strings;
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $sql = "select * from vtiger_asteriskextensions where userid = " . $current_user->id;
    $result = $adb->query($sql);
    $asterisk_extension = $adb->query_result($result, 0, "asterisk_extension");
    $query = "select * from vtiger_asteriskincomingcalls where to_number = " . $asterisk_extension;
    $result = $adb->query($query);
    if ($adb->num_rows($result) > 0) {
        $callerNumber = $adb->query_result($result, 0, "from_number");
        $callerName = $adb->query_result($result, 0, "from_name");
        $callerType = $adb->query_result($result, 0, "callertype");
        if (!empty($callerType)) {
            $caller = getCallerName("{$callerType}:" . $callerNumber);
        } else {
            $caller = getCallerName($callerNumber);
        }
        $adb->query("delete from vtiger_asteriskincomingcalls where to_number = " . $asterisk_extension);
        //prepare the div for incoming calls
        $status = "\t<table  border='0' cellpadding='5' cellspacing='0'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td style='padding:10px;' colspan='2'><b>Incoming Call</b></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t<table  border='0' cellpadding='0' cellspacing='0' class='hdrNameBg'>\n\t\t\t\t\t\t<tr><td style='padding:10px;' colspan='2'><b>Caller Information</b>\n\t\t\t\t\t\t\t<br><b>Number:</b> {$callerNumber}\n\t\t\t\t\t\t\t<br><b>Name:</b> {$callerName}\n\t\t\t\t\t\t</td></tr>\n\t\t\t\t\t\t<tr><td style='padding:10px;' colspan='2'><b>Information from vtigerCRM</b>\n\t\t\t\t\t\t\t<br>{$caller}\n\t\t\t\t\t\t</td></tr>\n\t\t\t\t\t</table>";
        require_once 'modules/Calendar/Activity.php';
        $focus = new Activity();
        $focus->column_fields['subject'] = "Incoming call from {$callerName} ({$callerNumber})";
        $focus->column_fields['activitytype'] = "Call";
        $focus->column_fields['date_start'] = date('Y-m-d');
        $focus->column_fields['due_date'] = date('Y-m-d');
        $focus->column_fields['time_start'] = date('H:i');
        $focus->column_fields['time_end'] = date('H:i');
        $focus->column_fields['eventstatus'] = "Held";
        $focus->column_fields['assigned_user_id'] = $current_user->id;
        $focus->save('Calendar');
        $callerInfo = getCallerInfo("{$callerType}:" . $callerNumber);
        if ($callerInfo == false) {
            $callerInfo = getCallerInfo(getStrippedNumber($callerNumber));
        }
        if ($callerInfo != false) {
            $tablename = array('Contacts' => 'vtiger_cntactivityrel', 'Accounts' => 'vtiger_seactivityrel', 'Leads' => 'vtiger_seactivityrel');
            $sql = "insert into " . $tablename[$callerInfo['module']] . " values (?,?)";
            $params = array($callerInfo[id], $focus->id);
            $adb->pquery($sql, $params);
        }
    } else {
        $status = "failure";
    }
    return $status;
}
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:50,代码来源:TraceIncomingCall.php

示例14: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Activity();
     // Associate goal with current user.
     $model->userId = Yii::app()->user->id;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Activity'])) {
         $model->attributes = $_POST['Activity'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model, 'goals' => Goal::model()->findAllByAttributes(array('userId' => $model->userId))));
 }
开发者ID:nellessen,项目名称:mentor-php,代码行数:19,代码来源:ActivityController.php

示例15: testActivityCRUD

 /**
  * Test Activity
  */
 public function testActivityCRUD()
 {
     $activity = new Activity();
     $activity->_id = \app\locker\helpers\Helpers::getRandomValue();
     $activity->definition = array('type' => \app\locker\helpers\Helpers::getRandomValue(), 'name' => array('en-US' => \app\locker\helpers\Helpers::getRandomValue()), 'description' => array('en-US' => \app\locker\helpers\Helpers::getRandomValue()));
     $result = $activity->save();
     $this->assertTrue($result);
     // Load activity from db
     $aid = $activity->_id;
     $db_activity = Activity::find($aid);
     $this->assertEquals($db_activity->_id, $activity->_id);
     // Delete activity
     $db_activity->delete();
     $this->assertEquals(Activity::find($aid), NULL);
 }
开发者ID:jesposito,项目名称:learninglocker,代码行数:18,代码来源:ActivityTest.php


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