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


PHP Events::save方法代码示例

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


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

示例1: addPost

 public function addPost()
 {
     $rules = array('name' => 'required|min:3|max:128', 'description' => 'required', 'file' => 'mimes:jpg,gif,png');
     $logo = '';
     $name = Input::get('name');
     $description = Input::get('description');
     $author_id = Input::get('author_id');
     $tags = Input::get('tags');
     if (Input::hasFile('file')) {
         $file = Input::file('file');
         $ext = $file->guessClientExtension();
         $filename = $file->getClientOriginalName();
         $file->move(public_path() . '/data', md5(date('YmdHis') . $filename) . '.' . $ext);
         $logo = md5(date('YmdHis') . $filename) . '.' . $ext;
     }
     $new_group = array('name' => $name, 'description' => $description, 'author_id' => $author_id, 'views' => 0, 'logo' => $logo, 'tags' => $tags);
     $v = Validator::make($new_group, $rules);
     if ($v->fails()) {
         // redirect back to the form with
         // errors, input and our currently
         // logged in user
         return Redirect::to('events/add')->with('user', Auth::user())->withErrors($v)->withInput();
     }
     // create the new post
     $group = new Events($new_group);
     $group->save();
     // redirect to viewing our new post
     return Redirect::to('events/view/' . $group->id);
 }
开发者ID:shinichi81,项目名称:laravel4demo,代码行数:29,代码来源:EventsController.php

示例2: addDetailedCalendar

function addDetailedCalendar($st, $et, $sub, $ade, $dscr, $loc, $color, $tz)
{
    $ret = array();
    try {
        $event = new Events();
        $event->title = mysql_real_escape_string($sub);
        $event->starttime = php2MySqlTime(js2PhpTime($st));
        $event->endtime = php2MySqlTime(js2PhpTime($et));
        $event->isalldayevent = mysql_real_escape_string($ade);
        $event->description = mysql_real_escape_string($dscr);
        $event->location = mysql_real_escape_string($loc);
        $event->color = mysql_real_escape_string($color);
        if ($event->save() == false) {
            $ret['IsSuccess'] = false;
            $ret['Msg'] = $event->error();
        } else {
            $ret['IsSuccess'] = true;
            $ret['Msg'] = 'add success';
            $ret['Data'] = $event->id;
        }
    } catch (Exception $e) {
        $ret['IsSuccess'] = false;
        $ret['Msg'] = $e->getMessage();
    }
    return $ret;
}
开发者ID:ranvirp,项目名称:rdp,代码行数:26,代码来源:datafeed.php

示例3: run

 public function run($id)
 {
     $formModel = new EventCommentPublisherFormModel();
     $profile = Yii::app()->params->profile;
     $model = $this->controller->lookUpModel($id, 'Events');
     $this->controller->dataUrl = Yii::app()->request->url;
     if ($model->checkPermissions('view')) {
         if (isset($_POST['EventCommentPublisherFormModel'])) {
             $formModel->setAttributes($_POST['EventCommentPublisherFormModel']);
             if (isset($_FILES['EventCommentPublisherFormModel'])) {
                 $model->photo = CUploadedFile::getInstance($model, 'photo');
             }
             if ($formModel->validate()) {
                 $event = new Events();
                 $event->setAttributes(array('visibility' => X2PermissionsBehavior::VISIBILITY_PUBLIC, 'user' => $profile->username, 'type' => 'structured-feed', 'associationType' => 'Events', 'associationId' => $id, 'text' => $formModel->text, 'photo' => $formModel->photo), false);
                 if ($event->save()) {
                     $formModel->text = '';
                     if (!isset($_FILES['EventCommentPublisherFormModel'])) {
                     } else {
                         Yii::app()->end();
                     }
                 } else {
                     throw new CHttpException(500, implode(';', $event->getAllErrorMessages()));
                 }
             }
         }
         $dataProvider = new CActiveDataProvider('Events', array('criteria' => array('order' => 'timestamp ASC', 'condition' => "type in ('comment', 'structured-feed') AND \n                         associationType='Events' AND associationId={$id}"), 'pagination' => array('pageSize' => 30)));
         $this->controller->render($this->pathAliasBase . 'views.mobile.viewEvent', array('model' => $model, 'dataProvider' => $dataProvider, 'formModel' => $formModel));
     } else {
         $this->controller->denied();
     }
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:32,代码来源:MobileViewEventAction.php

示例4: postCreateEvent

 /**
  * Ajax Api for getting event types
  */
 public function postCreateEvent()
 {
     $title = Input::get('title');
     $start = Input::get('start');
     $end = Input::get('end');
     $allDay = Input::get('allDay');
     $category = Input::get('category');
     $content = Input::get('content');
     $school_id = $this->getSchoolId();
     if ($allDay == "true") {
         $allDay = 1;
     } else {
         $allDay = 0;
     }
     $event = new Events();
     $event->title = $title;
     $event->start = date($start);
     $event->end = date($end);
     $event->allday = $allDay;
     $event->category = $category;
     $event->content = $content;
     $event->school_id = $school_id;
     if ($event->save()) {
         $response = array('status' => 'Success', 'result' => array('events' => $event));
         return Response::json($response);
     } else {
         $response = array('status' => 'Failed', 'result' => array('events' => 'none'));
         return Response::json($response);
     }
 }
开发者ID:vivekjaiswal90,项目名称:schoolopedia,代码行数:33,代码来源:AdminEventsController.php

示例5: actionCreate

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

示例6: addEvent

 public function addEvent($attr, $image)
 {
     $model = new Events();
     $model->setAttributes($attr);
     $model->created_at = time();
     $model->updated_at = time();
     $model->status = 1;
     $model->images = $image;
     if ($model->save(FALSE)) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:huynt57,项目名称:hatch,代码行数:13,代码来源:Events.php

示例7: actionCreate

 /**
  * Új eseményt ír ki a megadott tantárgyhoz.
  * @param int $id A tantárgy azonosítója
  */
 public function actionCreate($id)
 {
     if (Yii::app()->user->getId() == null) {
         throw new CHttpException(403, "Ezt a funkciót csak regisztrált felhasználók használhatják");
     }
     $model = new Events('insert');
     $model->time = $_POST["time"];
     $model->type = $_POST["type"];
     $model->notes = $_POST["notes"];
     $model->subject_id = $id;
     $model->save();
     $this->redirect(Yii::app()->createUrl("event/list", array("id" => $id)));
 }
开发者ID:std66,项目名称:de-pti,代码行数:17,代码来源:EventController.php

示例8: postCreate

 public function postCreate()
 {
     $event = new Events();
     $event->title = Input::get('title');
     $event->content = Input::get('content');
     $event->upload = Input::get('upload') == 'true' ? true : false;
     $event->type = 'event';
     $event->status = 'draft';
     if ($event->save()) {
         return Redirect::to($this->route)->with('msg_success', Lang::get('messages.events_create', array('title' => $event->title)));
     } else {
         return Redirect::to($this->route)->with('msg_error', Lang::get('messages.events_create_err', array('title' => $event->title)));
     }
 }
开发者ID:nagyist,项目名称:abge,代码行数:14,代码来源:EventController.php

示例9: addEvent

 static function addEvent($inputs)
 {
     $event = new Events();
     $event->name = $inputs['eventName'];
     $event->event_description = $inputs['eventDescription'];
     $event->event_date = date("Y-m-d", strtotime($inputs['eventDate']));
     $event->area = $inputs['eventLocation'];
     $event->type = $inputs['eventType'];
     $event->state = $inputs['state'];
     $event->city = $inputs['city'];
     $event->created_by = Session::get('userId');
     $event->created_at = date("Y-m-d H:i:s");
     $event->save();
     return $event;
 }
开发者ID:Headrun-php,项目名称:TLG,代码行数:15,代码来源:Events.php

示例10: actionIndex

 public function actionIndex()
 {
     $event = new Events();
     $event->attributes = $_GET;
     if (!isset($_GET['content_id'])) {
         $content = Content::model()->findByAttributes(array('slug' => Cii::get($_GET, 'uri', NULL)));
         if ($content !== NULL) {
             $event->content_id = $content->id;
         }
     }
     if ($event->save()) {
         Yii::app()->end();
     }
     return $this->returnError(400, NULL, $event->getErrors());
 }
开发者ID:fandikurnia,项目名称:CiiMS,代码行数:15,代码来源:EventController.php

示例11: sendEvent

 protected static function sendEvent($event, $type, $description)
 {
     $message = new Events();
     if (!$type) {
         $type = 'Не передан тип';
     }
     if (!$description) {
         $description = 'Отсутствует описание';
     }
     $message->type = $type;
     $message->event_id = $event;
     $message->description = $description;
     $message->timestamp = time();
     $message->status = self::STATUS_ACTIVE;
     $message->save();
     return $message->id;
 }
开发者ID:keltstr,项目名称:dipstart-development,代码行数:17,代码来源:EventHelper.php

示例12: run

 public function run()
 {
     $model = new EventPublisherFormModel();
     $profile = Yii::app()->params->profile;
     if (isset($_POST['EventPublisherFormModel'])) {
         $model->setAttributes($_POST['EventPublisherFormModel']);
         if (isset($_FILES['EventPublisherFormModel'])) {
             $model->photo = CUploadedFile::getInstance($model, 'photo');
         }
         //AuxLib::debugLogR ('validating');
         if ($model->validate()) {
             //AuxLib::debugLogR ('valid');
             $event = new Events();
             $event->setAttributes(array('visibility' => X2PermissionsBehavior::VISIBILITY_PUBLIC, 'user' => $profile->username, 'type' => 'structured-feed', 'text' => $model->text, 'photo' => $model->photo), false);
             if ($event->save()) {
                 if (!isset($_FILES['EventPublisherFormModel'])) {
                     //AuxLib::debugLogR ('saved');
                     $this->controller->redirect($this->controller->createAbsoluteUrl('/profile/mobileActivity'));
                 } else {
                     echo CJSON::encode(array('redirectUrl' => $this->controller->createAbsoluteUrl('/profile/mobileActivity')));
                     Yii::app()->end();
                 }
             } else {
                 //AuxLib::debugLogR ('invalid');
                 throw new CHttpException(500, implode(';', $event->getAllErrorMessages()));
             }
         } else {
             if (isset($_FILES['EventPublisherFormModel'])) {
                 throw new CHttpException(500, implode(';', $event->getAllErrorMessages()));
             }
             //AuxLib::debugLogR ('invalid model');
             //AuxLib::debugLogR ($model->getErrors ());
         }
     }
     $this->controller->render($this->pathAliasBase . 'views.mobile.eventPublisher', array('profile' => $profile, 'model' => $model));
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:36,代码来源:MobilePublisherAction.php

示例13: 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);
     if ($model->type == null) {
         $model->scenario = 'menu';
     }
     $old_title = $model->name;
     $new_title = $old_title;
     if (isset($_POST['Docs'])) {
         $new_title = $_POST['Docs']['name'];
     }
     if (isset($_POST['Docs'])) {
         $model->attributes = $_POST['Docs'];
         $model->visibility = $_POST['Docs']['visibility'];
         if ($model->save()) {
             $this->titleUpdate($old_title, $new_title);
             $event = new Events();
             $event->associationType = 'Docs';
             $event->associationId = $model->id;
             $event->type = 'doc_update';
             $event->user = Yii::app()->user->getName();
             $event->visibility = $model->visibility;
             $event->save();
             $this->redirect(array('update', 'id' => $model->id, 'saved' => true, 'time' => time()));
         }
     }
     $this->render('update', array('model' => $model));
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:33,代码来源:DocsController.php

示例14: 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

示例15: actionClick

 /**
  * Track when an email is viewed, a link is clicked, or the recipient unsubscribes
  *
  * Campaign emails include an img tag to a blank image to track when the message was opened,
  * an unsubscribe link, and converted links to track when a recipient clicks a link.
  * All those links are handled by this action.
  *
  * @param integer $uid The unique id of the recipient
  * @param string $type 'open', 'click', or 'unsub'
  * @param string $url For click types, this is the urlencoded URL to redirect to
  * @param string $email For unsub types, this is the urlencoded email address
  *  of the person unsubscribing
  */
 public function actionClick($uid, $type, $url = null, $email = null)
 {
     $now = time();
     $item = CActiveRecord::model('X2ListItem')->with('contact', 'list')->findByAttributes(array('uniqueId' => $uid));
     // It should never happen that we have a list item without a campaign,
     // but it WILL happen on any old db where x2_list_items does not cascade on delete
     // we can't track anything if the listitem was deleted, but at least prevent breaking links
     if ($item === null || $item->list->campaign === null) {
         if ($type == 'click') {
             // campaign redirect link click
             $this->redirect(urldecode($url));
         } elseif ($type == 'open') {
             //return a one pixel transparent gif
             header('Content-Type: image/gif');
             echo base64_decode('R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
         } elseif ($type == 'unsub' && !empty($email)) {
             Contacts::model()->updateAll(array('doNotEmail' => true), 'email=:email', array(':email' => $email));
             X2ListItem::model()->updateAll(array('unsubscribed' => time()), 'emailAddress=:email AND unsubscribed=0', array('email' => $email));
             $message = Yii::t('marketing', 'You have been unsubscribed');
             echo '<html><head><title>' . $message . '</title></head><body>' . $message . '</body></html>';
         }
         return;
     }
     $contact = $item->contact;
     $list = $item->list;
     $event = new Events();
     $notif = new Notification();
     $action = new Actions();
     $action->completeDate = $now;
     $action->complete = 'Yes';
     $action->updatedBy = 'API';
     $skipActionEvent = true;
     if ($contact !== null) {
         $skipActionEvent = false;
         if ($email === null) {
             $email = $contact->email;
         }
         $action->associationType = 'contacts';
         $action->associationId = $contact->id;
         $action->associationName = $contact->name;
         $action->visibility = $contact->visibility;
         $action->assignedTo = $contact->assignedTo;
         $event->associationId = $action->associationId;
         $event->associationType = 'Contacts';
         if ($action->assignedTo !== '' && $action->assignedTo !== 'Anyone') {
             $notif->user = $contact->assignedTo;
             $notif->modelType = 'Contacts';
             $notif->modelId = $contact->id;
             $notif->createDate = $now;
             $notif->value = $item->list->campaign->getLink();
         }
     } elseif ($list !== null) {
         $action = new Actions();
         $action->type = 'note';
         $action->createDate = $now;
         $action->lastUpdated = $now;
         $action->completeDate = $now;
         $action->complete = 'Yes';
         $action->updatedBy = 'admin';
         $action->associationType = 'X2List';
         $action->associationId = $list->id;
         $action->associationName = $list->name;
         $action->visibility = $list->visibility;
         $action->assignedTo = $list->assignedTo;
     }
     if ($type == 'unsub') {
         $item->unsubscribe();
         // find any weblists associated with the email address and create unsubscribe actions
         // for each of them
         $sql = 'SELECT t.* 
             FROM x2_lists as t 
             JOIN x2_list_items as li ON t.id=li.listId 
             WHERE li.emailAddress=:email AND t.type="weblist";';
         $weblists = Yii::app()->db->createCommand($sql)->queryAll(true, array('email' => $email));
         foreach ($weblists as $weblist) {
             $weblistAction = new Actions();
             $weblistAction->disableBehavior('changelog');
             //$weblistAction->id = 0; // this causes primary key contraint violation errors
             $weblistAction->isNewRecord = true;
             $weblistAction->type = 'email_unsubscribed';
             $weblistAction->associationType = 'X2List';
             $weblistAction->associationId = $weblist['id'];
             $weblistAction->associationName = $weblist['name'];
             $weblistAction->visibility = $weblist['visibility'];
             $weblistAction->assignedTo = $weblist['assignedTo'];
             $weblistAction->actionDescription = Yii::t('marketing', 'Campaign') . ': ' . $item->list->campaign->name . "\n\n" . $email . " " . Yii::t('marketing', 'has unsubscribed') . ".";
             $weblistAction->save();
//.........这里部分代码省略.........
开发者ID:shayanyi,项目名称:CRM,代码行数:101,代码来源:MarketingController.php


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