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


PHP Campaign::find方法代码示例

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


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

示例1: view_all

 public function view_all()
 {
     $this->output->enable_profiler(true);
     $this->load->model('Campaign');
     $campaigns = Campaign::find();
     foreach ($campaigns as $campaign) {
         $campaign->with_next_id_card();
     }
     $this->layout->add_basic_assets()->menu()->action_view(array('campaigns' => $campaigns));
 }
开发者ID:vmoulin77,项目名称:DVB,代码行数:10,代码来源:Campaign_controller.php

示例2: afterSave

 public function afterSave($data)
 {
     //print_r($data);
     //exit();
     if ($data['sendOption'] == 'immediately') {
         //make queue id
         $qid = Prefs::makeQueueId();
         $qdate = new MongoDate();
         $cid = $data['_id']->toString();
         $cmp = Campaign::find($cid);
         $cmp->push(array('queueId' => $qid, 'queueInitTime' => $qdate));
         $cmp->save();
         //put into queue
         //set history
     } else {
     }
     return $data;
 }
开发者ID:awidarto,项目名称:tmadminflat,代码行数:18,代码来源:CampaignController.php

示例3: edit

 public function edit($id, $id_campaign = null)
 {
     //$this->output->enable_profiler(true);
     $id = (int) $id;
     $this->load->model('Card');
     $this->form_validation->set_rules('num', 'Number', 'required|integer');
     $this->form_validation->set_rules('word_english', 'English', 'required');
     $this->form_validation->set_rules('word_french', 'French', 'required');
     $this->layout->add_basic_assets()->menu();
     if ($this->form_validation->run() === false) {
         $card = Card::find($id);
         $data = array('id' => $id, 'num' => $card->get_num(), 'word_english' => str_replace('<br />', "\n", $card->get_card_content()->get_word_english()), 'word_french' => str_replace('<br />', "\n", $card->get_card_content()->get_word_french()), 'is_active_english' => $card->get_card_content()->get_is_active_english(), 'is_active_french' => $card->get_card_content()->get_is_active_french(), 'id_campaign' => $id_campaign);
         $create_edit = $this->layout->views('controllers/Card/actions/create_edit', $data, array('css', 'js'), true);
         $this->layout->action_view(array('create_edit' => $create_edit));
     } else {
         $data = array('num' => (int) $this->input->post('num'), 'word_english' => $this->input->post('word_english'), 'word_french' => $this->input->post('word_french'), 'is_active_english' => $this->input->post('is_active_english'), 'is_active_french' => $this->input->post('is_active_french'));
         $result = Card::update($id, $data, $id_campaign);
         if ($result === true) {
             if ($id_campaign === null) {
                 $this->layout->view('others/form_success');
             } else {
                 $this->load->model('Campaign');
                 $campaign = Campaign::find($id_campaign);
                 $campaign->with_next_id_card();
                 if ($campaign->next_id_card === null) {
                     $this->layout->view('controllers/Campaign/actions/completed');
                 } else {
                     redirect('/Card/edit/' . $campaign->next_id_card . '/' . $id_campaign);
                 }
             }
         } elseif ($result instanceof Standard_error) {
             $this->layout->views('others/form_failure', array('message' => $result->message));
             $data = array('id' => $id, 'num' => $this->input->post('num'), 'word_english' => $this->input->post('word_english'), 'word_french' => $this->input->post('word_french'), 'is_active_english' => $this->input->post('is_active_english'), 'is_active_french' => $this->input->post('is_active_french'), 'id_campaign' => $id_campaign);
             $create_edit = $this->layout->views('controllers/Card/actions/create_edit', $data, array('css', 'js'), true);
             $this->layout->action_view(array('create_edit' => $create_edit));
         }
     }
 }
开发者ID:vmoulin77,项目名称:DVB,代码行数:38,代码来源:Card_controller.php

示例4: adminreportbatchreplyAction

 function adminreportbatchreplyAction()
 {
     $reportId = $this->_request->getParam('report_id');
     $this->view->batchId = $this->_request->getParam('batch_id');
     $reportModel = new Report();
     $report = $reportModel->find($reportId)->current();
     $this->view->report_id = $reportId;
     $consumerModel = new Consumer();
     $this->view->consumer = $consumerModel->find($report['consumer_id'])->current();
     $campaignModel = new Campaign();
     $campaign = $campaignModel->find($report['campaign_id'])->current();
     $this->view->campaign_name = $campaign->name;
     $this->view->campaign_id = $campaign->id;
     //get new report
     $config = Zend_Registry::get('config');
     $url = $config->indicate2->home . "/report/showAnswer/accessCode/" . $report['accesscode'];
     //		$contents = file_get_contents($url); // deprecated by ice, for performance reason
     //		$handle = @fopen($url, "r");
     //		stream_set_timeout($handle, 0, 500);// 500  ms
     //		$contents = stream_get_contents($handle);
     //		$info = stream_get_meta_data($handle);
     //		fclose($handle);
     $this->view->url = $url;
     $this->view->title = "Reply Reports";
     $this->view->activeTab = "Reply Reports";
     $this->view->mailForm = new ReplyReportForm();
     $this->view->mailForm->email->setValue($this->view->consumer['email']);
     $db = Zend_Registry::get('db');
     $selectReportSourceAndPoint = $db->select();
     $selectReportSourceAndPoint->from('report', array('source', 'campaign_id'))->joinLeft('reward_point_transaction_record', 'report.reward_point_transaction_record_id = reward_point_transaction_record.id', 'point_amount')->where('report.id = ?', $reportId);
     $reportSourceAndPoint = $db->fetchAll($selectReportSourceAndPoint);
     //		Zend_Debug::dump($reportSourceAndPoint);
     if (isset($reportSourceAndPoint)) {
         $this->view->reportSource = $reportSourceAndPoint[0]['source'];
         if ($this->view->reportSource == 'sms' || empty($this->view->consumer['email'])) {
             $this->view->reportSource = 'sms';
             $this->view->mailForm->email->setLabel($this->view->translate('Phone:'));
             $this->view->mailForm->email->setValue($this->view->consumer['phone']);
             $this->view->mailForm->message->setLabel($this->view->translate('Admin_Reply_Message_Sms_Note'));
             $this->view->mailForm->message->setAttribs(array('rows' => 2, 'cols' => 50));
         }
     }
     if (isset($reportSourceAndPoint) && $reportSourceAndPoint[0]['point_amount'] != null) {
         $this->view->mailForm->grade->setValue($reportSourceAndPoint[0]['point_amount']);
     }
     //tag for report
     $selectTags = $db->select();
     $selectTags->from('tags', array('name', 'id', 'sort'))->where("module = 'REPORT' and (campaign_id is null or campaign_id=" . $reportSourceAndPoint[0]['campaign_id'] . ")")->order('sort');
     $this->view->tags = $db->fetchAll($selectTags);
     $selectSelectedTags = $db->select();
     $selectSelectedTags->from('report_tag', array('tag_id'))->where('report_id = ?', $reportId);
     $selectedTags = $db->fetchAll($selectSelectedTags);
     $this->view->selectedTagsArray = array();
     foreach ($selectedTags as $tag) {
         $this->view->selectedTagsArray[$tag['tag_id']] = '1';
     }
     //		Zend_Debug::dump($this->view->selectedTagsArray);
     $replyModel = new Reply();
     $reply = $replyModel->fetchRow('report_id = ' . $reportId);
     if ($reply != null) {
         $this->view->mailForm->message->setValue($reply['content']);
         $this->view->status = $reply['status'];
     }
     $this->view->usetime = $reply['usetime'];
     var_dump($reply['usetime']);
     $this->view->mailForm->subject->setValue($this->view->translate('Admin_Reply_WOM_Report_Subject'));
     $this->_helper->layout->setLayout("layout_admin");
     //organize tag list
     $tagHash = array();
     foreach ($this->view->tags as $tag) {
         $tagHash[$tag['id']] = $tag['name'];
     }
     // get old reports of this campaign
     $select = $db->select();
     $select->from('report', array('id', 'accesscode', 'create_date'))->where('consumer_id = ?', $this->view->consumer['id'])->where('campaign_id = ?', $campaign->id)->order('create_date desc');
     $oldreportArray = $db->fetchAll($select);
     $this->view->oldreports = array();
     $i = 1;
     foreach ($oldreportArray as $oldreport) {
         $oldTags = '';
         if ($report['accesscode'] != $oldreport["accesscode"]) {
             $this->view->oldreports[$oldreport["accesscode"]]['url'] = $config->indicate2->home . "/report/showAnswer/accessCode/" . $oldreport["accesscode"];
             $reply = $replyModel->fetchRow('report_id = ' . $oldreport['id']);
             if ($reply['admin_id'] != null) {
                 $adminModel = new Admin();
                 $admin = $adminModel->fetchRow('id = ' . $reply['admin_id']);
                 $adminname = $admin['name'];
             } else {
                 $adminname = '';
             }
             $this->view->oldreports[$oldreport["accesscode"]]['id'] = $oldreport['id'];
             $this->view->oldreports[$oldreport["accesscode"]]['create_date'] = $oldreport['create_date'];
             $this->view->oldreports[$oldreport["accesscode"]]['adminname'] = $adminname;
             $this->view->oldreports[$oldreport["accesscode"]]['replydate'] = $reply['date'];
             $this->view->oldreports[$oldreport["accesscode"]]['replycontent'] = $reply['content'];
             //tag
             $oldreportTagSelect = $db->select();
             $oldreportTagSelect->from('report_tag', 'tag_id')->where('report_tag.report_id = ?', $oldreport['id']);
             $oldreportTag = $db->fetchAll($oldreportTagSelect);
             foreach ($oldreportTag as $tag) {
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:wildfire_php,代码行数:101,代码来源:ReportController.php

示例5: postDelete

 public function postDelete($id)
 {
     $campaign = Campaign::find($id);
     // If no item in database
     if (empty($campaign) || empty($campaign->id)) {
         return Redirect::route('public.campaigns')->with('message', Lang::get('campaigns.edit.inexistant'));
     }
     if (!($campaign->vendor->id == Auth::user()->id || Auth::user()->role()->first()->name_tag == 'admin')) {
         return Redirect::back()->with('message', Lang::get('public.campaigns.delete.unauthorized'));
     }
     try {
         $campaign->delete();
     } catch (Exception $e) {
         return Redirect::back()->with('message', Lang::get('campaigns.delete.error'))->withInput();
     }
     return Redirect::back()->with('message', Lang::get('campaigns.delete.message', array('title' => Input::get('title'))));
 }
开发者ID:ddcint,项目名称:benefund,代码行数:17,代码来源:CampaignsController.php

示例6: editcontactAction

 function editcontactAction()
 {
     $campaign = $this->_request->getParam('cid');
     $campaignModel = new Campaign();
     $cam = $campaignModel->find($campaign)->current();
     $form = new ConsumerContactForm(array('relative' => $cam->relative));
     $consumerModel = new Consumer();
     if ($this->_request->isPost()) {
         //POST
         $formData = $this->_request->getPost();
         //Zend_Debug::dump($form->isValid ( $formData ));die;
         if ($form->isValid($formData)) {
             $id = $this->_currentUser->id;
             $consumer = $consumerModel->find($id)->current();
             $consumer->recipients_name = $form->getValue('recipients_name');
             $consumer->phone = $form->getValue('phone');
             $consumer->company_phone = $form->getValue('telephone');
             $consumer->address1 = $form->getValue('address1');
             $consumer->postalcode = $form->getValue('postalcode');
             if ($formData['qq'] != null) {
                 $consumer->qq = $formData['qq'];
             }
             if ($formData['city'] != null && $formData['province'] != null) {
                 $consumer->city = $formData['city'];
                 $consumer->province = $formData['province'];
             }
             if ($formData['englishcity'] != null) {
                 $consumer->city = $formData['englishcity'];
                 $consumer->province = null;
             }
             if ($formData['birthdate'] != null) {
                 $consumer->birthdate = $formData['birthdate'];
             }
             if ($formData['qq'] != null) {
                 $consumer->qq = $formData['qq'];
             }
             if ($formData['province'] == '' && $formData['englishcity'] == null) {
                 $consumer->city = null;
                 $consumer->province = null;
             }
             $consumer->save();
             $authNamespace = new Zend_Session_Namespace('Zend_Auth');
             $authNamespace->user = $consumer;
             $form->populate($consumer->toArray());
             $consumerextraModel = new ConsumerExtraInfo();
             $consumerextra = $consumerextraModel->fetchRow('consumer_id = ' . $this->_currentUser->id);
             if ($consumerextra == null) {
                 $consumerextra = $consumerextraModel->createRow();
                 $consumerextra->consumer_id = $this->_currentUser->id;
             }
             $consumerextra->gender = isset($formData['gender']) ? $formData['gender'] : null;
             $consumerextra->birthdate = $formData['birthdate'] != null ? $formData['birthdate'] : null;
             $consumerextra->education = $formData['education'];
             $consumerextra->income = $formData['income'];
             $consumerextra->save();
             //2011-05-03 ham.bao add the related friends
             $consumerFriend = new ConsumerFriend();
             $consumerFriend->delete('consumer =' . $consumer->id . ' and campaign=' . $campaign);
             //delete
             /*foreach ( $formData as $key =>$val ){
             			$consumerFriend = new ConsumerFriend();
             			if((substr($key, 0,6) == 'friend')&& ($val != '')){
             				$friend = $consumerFriend->createRow();
             				$friend->consumer = $id;
             				$friend->campaign = $campaign;
             				$friend->friend = $val;
             				$friend->date = date('m-d-Y H:i:s');
             				$friend->save();
             			}
             		}*/
             //2011-05-03 ham.bao add the related friends
             $campaign_model = new Campaign();
             $campaign_campaign = $campaign_model->find($campaign)->current();
             //				Zend_Debug::dump($campaign_campaign->relative);die;
             //new
             for ($i = 1; $i <= $campaign_campaign->relative; $i++) {
                 if ($formData['friend_name_' . $i] && $formData['friend_name_' . $i] != '') {
                     $consumerFriend = new ConsumerFriend();
                     $friend = $consumerFriend->createRow();
                     $friend->consumer = $id;
                     $friend->campaign = $campaign;
                     $friend->name = $formData['friend_name_' . $i];
                     //change column name in db
                     $friend->email = $formData['friend_email_' . $i];
                     //add column in db
                     $friend->message = $formData['friend_message_' . $i];
                     //add column in db
                     $friend->date = date('Y-m-d H:i:s');
                     $friend->save();
                 }
             }
             $this->_helper->redirector('index', 'campaigninvitation');
         } else {
             $this->view->errMessage = "Please fill out all mandatory fields and make sure your emails are correct!";
             $this->_forward('precampaignfinished', 'campaign', null, array('survey' => '643'));
         }
     } else {
     }
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:99,代码来源:ConsumerController.php


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