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


PHP Task::add方法代码示例

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


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

示例1: add_task

 public function add_task($tanggal = null)
 {
     $pegawai = new Pegawai($this->registry);
     $this->view->date = $tanggal;
     $this->view->pegawai = $pegawai->get();
     if (isset($_POST['submit'])) {
         $nomor = $_POST['nomor'];
         $mulai = $_POST['mulai'];
         $akhir = $_POST['akhir'];
         $jam_mulai = $_POST['jam_mulai'] . ':' . $_POST['menit_mulai'] . ':00';
         $jam_selesai = $_POST['jam_selesai'] . ':' . $_POST['menit_selesai'] . ':00';
         $tujuan = $_POST['tujuan'];
         $keperluan = $_POST['tentang'];
         $peserta = $_POST['peserta'];
         $d_mulai = strtotime($mulai);
         $d_akhir = strtotime($akhir);
         if ($nomor == '') {
             $this->view->add_error('nomor', 'kolom nomor harus diisi!');
         }
         if ($tujuan == '') {
             $this->view->add_error('tujuan', 'kolom daerah tujuan harus diisi!');
         }
         if ($keperluan == '') {
             $this->view->add_error('tentang', 'kolom keperluan harus diisi!');
         }
         if ($d_mulai > $d_akhir) {
             $this->view->add_error('tanggal', 'tanggal selesai tidak boleh sebelum tanggal mulai!');
         }
         if (!$this->view->is_error()) {
             $data = array('nomor' => $nomor, 'tgl_mulai' => $mulai, 'tgl_selesai' => $akhir, 'jam_mulai' => $jam_mulai, 'jam_selesai' => $jam_selesai, 'tujuan' => $tujuan, 'uraian' => $keperluan);
             $task = new Task($this->registry);
             $task->add($data);
             $id = $task->last_insert_id();
             $p = new PesertaTask($this->registry);
             $array = 0;
             foreach ($peserta as $key => $value) {
                 $t_mulai = $_POST['pmulai'][$array] == '' ? $mulai : $_POST['pmulai'][$array];
                 $t_akhir = $_POST['pakhir'][$array] == '' ? $akhir : $_POST['pakhir'][$array];
                 $data = array('id_pegawai' => $value, 'id_task' => $id, 'tgl_mulai' => $t_mulai, 'tgl_selesai' => $t_akhir);
                 $p->add($data);
                 $array++;
             }
             $this->view->add_success('success', 'rekam data task/kegiatan berhasil!');
         }
     }
     $this->view->aksi = 'add';
     $this->view->render('wekdal/kalendar');
 }
开发者ID:beruxganteng,项目名称:apnthc,代码行数:48,代码来源:WekdalController.php

示例2: initTask

 /**
  * 初始化一些定时任务
  * @return void
  */
 protected static function initTask()
 {
     // 任务初始化
     Task::init();
     // 测试环境定时获取worker包含的文件
     if (PHPServerConfig::get('ENV') == 'dev') {
         // 定时获取worker包含的文件
         Task::add(self::$commonWaitTimeLong, array('PHPServer', 'sendCmdToAll'), array(Cmd::CMD_REPORT_INCLUDE_FILE));
         // 定时检测终端是否关闭
         Task::add(self::$commonWaitTimeLong, array('PHPServer', 'checkTty'));
     } else {
         // 定时发送alarm命令
         Task::add(self::$commonWaitTimeLong, array('PHPServer', 'sendCmdToAll'), array(Cmd::CMD_PING));
     }
     // 如果不支持inotify则上报文件给FileMonitor进程来监控文件更新
     Task::add(self::$checkFilesTimeLong, function () {
         Reporter::reportIncludedFiles(PHPServer::getFilesToInotify());
     });
     // 检查worker内存占用情况
     Task::add(self::$checkStatusTimeLong, array('PHPServer', 'checkWorkersMemory'));
     // 检查心跳情况
     Task::add(self::$checkStatusTimeLong, array('PHPServer', 'checkPingInfo'));
     // 开发环境定时清理master输出
     if (PHPServerConfig::get('ENV') == 'dev') {
         Task::add(self::$commonWaitTimeLong, function () {
             @ob_clean();
         });
     }
 }
开发者ID:nangong92t,项目名称:go_src,代码行数:33,代码来源:PHPServer.php

示例3: edit

 public function edit($content, $user = null, $cuser = 0, $stime = 0)
 {
     $model = Sms::model()->findByPk($_GET['id']);
     $model->year = date('Y', time());
     $model->month = date('m', time());
     $model->day = date('d', time());
     $model->message = $content;
     $model->ctime = time();
     $model->stime = $stime;
     $model->user_id = $cuser;
     if (empty($user)) {
         $model->send_all = 1;
         $model->save();
     } else {
         $model->save();
         $users = $model->user();
         foreach ($users as $du) {
             $du->delete();
         }
         if (is_array($user)) {
             foreach ($user as $u) {
                 $sms_user = new SmsToUser();
                 $sms_user->sms_id = $model->id;
                 $sms_user->user_id = $u;
                 $sms_user->save();
             }
         } else {
             $sms_user = new SmsToUser();
             $sms_user->sms_id = $model->id;
             $sms_user->user_id = $user;
             $sms_user->save();
         }
     }
     if (empty($stime)) {
         Task::add('sms');
     } else {
         Task::add('sms,' . $stime);
     }
     return true;
 }
开发者ID:zt123,项目名称:Base-System,代码行数:40,代码来源:Sms.php

示例4: elseif

            $return_string = 'Next week';
        } elseif ($date_diff > 15) {
            $return_string = 'Later';
        }
        $due_date = $return_string;
        $is_sp_date_set = "Yes";
        $do_task = new Task();
        $do_task->addNew();
        $do_task->category = $category;
        $do_task->due_date = $due_date;
        $do_task->due_date_dateformat = $formated_date;
        $do_task->iduser = $iduser;
        $do_task->is_sp_date_set = $is_sp_date_set;
        $do_task->status = 'open';
        $do_task->task_description = $parse_content;
        $do_task->add();
        $do_task->free();
    }
}
/**
  * If the dropbox code is set to add the project note
  * Check if the sender is associated with the project task and if yes add the discussion for that project task
  * If the user is not associated with the project task then check if the project is a public project and if yes
  * add the discussion by specifying the drop_box_sender
*/
if ($addprojectnote === true) {
    $parse_content = ereg_replace("^\\>", "", $final_message_content);
    $do_project_task = new ProjectTask();
    $do_project_task->getTaskDetailByDropBoxCode($drop_box_code_proj_task);
    //echo $do_project_task->idproject_task; echo $do_project_task->idproject;die();
    //$do_task = new Task();
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:31,代码来源:ofuz_catch_new.php

示例5: array

    private $remoteDir = false;
    private $regexpPattern = false;
    private $regexpReplacement = false;
    private $connection = false;
    private $connectionType = false;
    private $connectionPort = false;
    private $connectionTimeout = 10;
    private $arItems = array();
}
/* * ***************************************************************************** */
date_default_timezone_set('Europe/Moscow');
error_reporting(E_ERROR);
$config = ['indexFile' => 'files10.csv', 'typeconn' => FTP_INTERFACE, 'host' => 'demo.your-host.ru', 'user' => 'demo', 'password' => 'your-password', 'start_dir' => "www/demo.your-host.ru"];
$task = new Task();
$task->setLocalDir('temp');
$task->setRemoteDir($config['start_dir']);
$task->connect($config['host'], $config['user'], $config['password'], FTP_PORT, FTP_INTERFACE);
$task->setRegexp('|[\\s\\n\\r]+|', null);
if ($task->checkConnection()) {
    System::showMessage("\n\n * * *  Read the index file ({$config['indexFile']}) and downloadable files");
    $index = new LimitIterator(new SplFileObject($config["indexFile"]), 0, 1);
    while (!$index->eof()) {
        if ($remoteFile = $index->fgetcsv()[0]) {
            $localFile = $task->add($remoteFile);
        }
    }
    System::showMessage("\n\n * * *  Create backups and perform replacing in files");
    $task->replacement();
}
$task->disconnect();
/* * ***************************************************************************** */
开发者ID:alexchurov,项目名称:test_ftp,代码行数:31,代码来源:test_ftp.php

示例6: Task

 function add_task()
 {
     $do_api_task = new Task();
     $do_api_contact = new Contact();
     $add_task = true;
     if ($this->task_description == '') {
         $this->setMessage("644", "Empty Task Description");
         $add_task = false;
         return false;
     } elseif (($this->idcontact || $this->idcontact != '') && !$do_api_contact->isContactRelatedToUser($this->idcontact, $this->iduser)) {
         $this->setMessage("615", "Contact does not belong to you nor shared by your Co-Worker");
         $add_task = false;
         return false;
     } else {
         if ($this->due_date != '') {
             if (preg_match("/^([0-9]{4})-([0-9]{2})-([0-9]{2})\$/", $this->due_date, $parts)) {
                 if (checkdate($parts[2], $parts[3], $parts[1])) {
                     $difference = strtotime($this->due_date) - strtotime($today);
                     $date_diff = round($difference / 60 / 60 / 24, 0);
                     if ($date_diff < 0) {
                         $due_date_dateformat = date("Y-m-d");
                         $due_date_str = 'Today';
                     } else {
                         $due_date_dateformat = $this->due_date;
                         $due_date_str = $do_api_task->convertDateToString($due_date_dateformat);
                     }
                 } else {
                     $this->setMessage("641", "Invalid date Format should be Y-m-d(2000-12-31)");
                     $add_task = false;
                     return false;
                 }
             } else {
                 $this->setMessage("642", "Invalid date");
                 $add_task = false;
                 return false;
             }
         }
         if ($add_task) {
             if ($this->due_date == '') {
                 $due_date_dateformat = date("Y-m-d");
                 $due_date_str = 'Today';
             }
             if ($this->task_category == '') {
                 $this->task_category = 'Email';
             }
             if (!$this->idcontact || $this->idcontact == '') {
                 $this->idcontact = 0;
             }
             $do_api_task->task_description = $this->task_description;
             $do_api_task->due_date = $due_date_str;
             $do_api_task->due_date_dateformat = $due_date_dateformat;
             $do_api_task->idcontact = $this->idcontact;
             $do_api_task->iduser = $this->iduser;
             $do_api_task->status = 'open';
             $do_api_task->task_category = $this->task_category;
             $do_api_task->add();
             $this->setValues(array("msg" => "Task Added", "stat" => "ok", "code" => "645"));
             return true;
         }
     }
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:61,代码来源:OfuzApiMethods.class.php

示例7: onServe

 /**
  * 该worker进程开始服务的时候会触发一次,可以在这里做一些全局的事情
  * @return bool
  */
 protected function onServe()
 {
     if (!is_dir(SERVER_BASE . 'logs/statistic')) {
         @mkdir(SERVER_BASE . 'logs/statistic', 0777);
     }
     Task::add(self::CHECK_STATUS_TIME_LONG, array($this, 'dealStatus'));
     Task::add(self::CHECK_BUSINESS_TIME_LONG, array($this, 'checkBusiness'));
     Task::add(self::CLEAR_LOGS_TIME_LONG, array($this, 'clearLogs'), array(SERVER_BASE . 'logs'));
 }
开发者ID:nangong92t,项目名称:go_src,代码行数:13,代码来源:Monitor.php

示例8: eventImportAccount

 function eventImportAccount(EventControler $evtcl)
 {
     $msg = "";
     $uploaded_file = $_FILES['fields']['name']['import_account'];
     $target_path = 'files/' . $uploaded_file;
     if (!move_uploaded_file($_FILES['fields']['tmp_name']['import_account'], $target_path)) {
         $msg = "There was an error uploading the file, please try again!";
     } else {
         chmod($target_path, 0755);
         if (file_exists($target_path)) {
             //$xml = simplexml_load_file($_SERVER['DOCUMENT_ROOT']."/".$target_path);
             $str_xml = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $target_path);
             $str_xml = preg_replace('/[^(\\x20-\\x7F)]*/', '', $str_xml);
             $xml = simplexml_load_string($str_xml);
             echo '<pre>';
             print_r($xml);
             echo '</pre>';
             die;
             if ($xml !== FALSE) {
                 $c_cnt = count($xml->contact);
                 if ($c_cnt) {
                     for ($i = 0; $i < $c_cnt; $i++) {
                         $do_contact = new Contact();
                         $contact = $xml->contact[$i];
                         $do_contact->firstname = $contact->firstname;
                         $do_contact->lastname = $contact->lastname;
                         $do_contact->position = $contact->position;
                         $do_contact->company = $contact->company;
                         $do_contact->idcompany = $contact->idcompany;
                         $do_contact->iduser = $_SESSION['do_User']->iduser;
                         $do_contact->picture = $contact->picture;
                         $do_contact->summary = $contact->summary;
                         $do_contact->birthday = $contact->birthday;
                         $do_contact->portal_code = $contact->portal_code;
                         $do_contact->fb_userid = $contact->fb_userid;
                         $do_contact->tw_user_id = $contact->tw_user_id;
                         $do_contact->email_optout = $contact->email_optout;
                         $do_contact->add();
                         $lastInsertedContId = $do_contact->getPrimaryKeyValue();
                         /**
                          *Contact Address	
                          */
                         $ca_cnt = count($contact->contact_address);
                         if ($ca_cnt) {
                             for ($ca_cnt_i = 0; $ca_cnt_i < $ca_cnt; $ca_cnt_i++) {
                                 $do_contact_address = new ContactAddress();
                                 $contact_address = $contact->contact_address[$ca_cnt_i];
                                 $do_contact_address->city = $contact_address->city;
                                 $do_contact_address->country = $contact_address->country;
                                 $do_contact_address->state = $contact_address->state;
                                 $do_contact_address->street = $contact_address->street;
                                 $do_contact_address->zipcode = $contact_address->zipcode;
                                 $do_contact_address->idcontact = $lastInsertedContId;
                                 $do_contact_address->address = $contact_address->address;
                                 $do_contact_address->address_type = $contact_address->address_type;
                                 $do_contact_address->add();
                                 $do_contact_address->free();
                             }
                         }
                         /**
                          *Contact Email	
                          */
                         $ce_cnt = count($contact->contact_email);
                         if ($ce_cnt) {
                             for ($ce_cnt_i = 0; $ce_cnt_i < $ce_cnt; $ce_cnt_i++) {
                                 $do_contact_email = new ContactEmail();
                                 $contact_email = $contact->contact_email[$ce_cnt_i];
                                 $do_contact_email->idcontact = $lastInsertedContId;
                                 $do_contact_email->email_address = $contact_email->email_address;
                                 $do_contact_email->email_type = $contact_email->email_type;
                                 $do_contact_email->email_isdefault = $contact_email->email_isdefault;
                                 $do_contact_email->add();
                                 $do_contact_email->free();
                             }
                         }
                         /**
                          *Contact Phone 
                          */
                         $cp_cnt = count($contact->contact_phone);
                         if ($cp_cnt) {
                             for ($cp_cnt_i = 0; $cp_cnt_i < $cp_cnt; $cp_cnt_i++) {
                                 $do_contact_phone = new ContactPhone();
                                 $contact_phone = $contact->contact_phone[$cp_cnt_i];
                                 $do_contact_phone->phone_number = $contact_phone->phone_number;
                                 $do_contact_phone->phone_type = $contact_phone->phone_type;
                                 $do_contact_phone->idcontact = $lastInsertedContId;
                                 $do_contact_phone->add();
                                 $do_contact_phone->free();
                             }
                         }
                         /**
                          *Contact Note	
                          */
                         $cn_cnt = count($contact->contact_note);
                         if ($cn_cnt) {
                             for ($cn_cnt_i = 0; $cn_cnt_i < $cn_cnt; $cn_cnt_i++) {
                                 $do_contact_note = new ContactNotes();
                                 $contact_note = $contact->contact_note[$cn_cnt_i];
                                 $do_contact_note->idcontact = $lastInsertedContId;
                                 $do_contact_note->note = $contact_note->note;
//.........这里部分代码省略.........
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:101,代码来源:RestoreAccount.class.php


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