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


PHP Jobs::create方法代码示例

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


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

示例1: display

 protected function display()
 {
     if (Tools::isConnectedUser()) {
         // Admins only
         $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
         if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
             $this->smartyHelper->assign('jobType', Job::$typeNames);
             $action = Tools::getSecurePOSTStringValue('action', 'none');
             if ('addJob' == $action) {
                 $job_name = Tools::getSecurePOSTStringValue('job_name');
                 $job_type = Tools::getSecurePOSTStringValue('job_type');
                 $job_color = Tools::getSecurePOSTStringValue('job_color');
                 // TODO check if not already in table !
                 // save to DB
                 Jobs::create($job_name, $job_type, $job_color);
             } elseif ('addAssociationProject' == $action) {
                 // Add Job to selected projects
                 $job_id = Tools::getSecurePOSTIntValue('job_id');
                 $proj = explode(",", Tools::getSecurePOSTStringValue('formattedProjects'));
                 foreach ($proj as $project_id) {
                     // TODO check if not already in table !
                     // save to DB
                     $query = "INSERT INTO `codev_project_job_table`  (`project_id`, `job_id`) VALUES ('" . $project_id . "','" . $job_id . "');";
                     $result = SqlWrapper::getInstance()->sql_query($query);
                     if (!$result) {
                         $this->smartyHelper->assign('error', T_("Couldn't add the job association"));
                     }
                 }
             } elseif ('deleteJob' == $action) {
                 $job_id = Tools::getSecurePOSTIntValue('job_id');
                 if (Jobs::JOB_NA == $job_id || Jobs::JOB_SUPPORT == $job_id) {
                     $this->smartyHelper->assign('error', T_("This job must not be deleted."));
                 } else {
                     $query = "DELETE FROM `codev_project_job_table` WHERE job_id = " . $job_id . ';';
                     $result = SqlWrapper::getInstance()->sql_query($query);
                     if (!$result) {
                         $this->smartyHelper->assign('error', T_("Couldn't remove the job association"));
                     }
                     $query = "DELETE FROM `codev_job_table` WHERE id = {$job_id};";
                     $result = SqlWrapper::getInstance()->sql_query($query);
                     if (!$result) {
                         $this->smartyHelper->assign('error', T_("Couldn't delete the job"));
                     }
                 }
             } elseif ('deleteJobProjectAssociation' == $action) {
                 $asso_id = Tools::getSecurePOSTIntValue('asso_id');
                 $query = "DELETE FROM `codev_project_job_table` WHERE id = " . $asso_id . ';';
                 $result = SqlWrapper::getInstance()->sql_query($query);
                 if (!$result) {
                     $this->smartyHelper->assign('error', T_("Couldn't remove the job association"));
                 }
             }
             $jobs = $this->getJobs();
             $this->smartyHelper->assign('jobs', $jobs);
             //$this->smartyHelper->assign('assignedJobs', $this->getAssignedJobs($jobs));
             $this->smartyHelper->assign('assignedJobs', $jobs);
             $projects = Project::getProjects();
             $this->smartyHelper->assign('projects', $projects);
             $this->smartyHelper->assign('tuples', $this->getAssignedJobTuples($projects));
         }
     }
 }
开发者ID:fg-ok,项目名称:codev,代码行数:62,代码来源:edit_jobs.php

示例2: newAction

 public function newAction()
 {
     if ($this->request->isPost()) {
         $messages = $this->formValidate();
         if (count($messages)) {
             $this->view->disable();
             $errorMsg = '';
             foreach ($messages as $msg) {
                 $errorMsg .= $msg . "<br>";
             }
             $this->flash->error('<button type="button" class="close" data-dismiss="alert">×</button>' . $errorMsg);
             return $this->response->redirect('job/new/');
         } else {
             $this->view->disable();
             echo "validation is either failed or passed";
         }
         $userSession = $this->session->get("userSession");
         $jobs = new Jobs();
         $jobs->created = date('Y-m-d H:i:s');
         $jobs->modified = date('Y-m-d H:i:s');
         $jobs->member_id = $userSession['id'];
         $jobs->position = $this->request->getPost('position');
         $jobs->job_category_id = $this->request->getPost('job_category_id');
         $jobs->job_description = $this->request->getPost('job_description');
         $jobs->requirements = $this->request->getPost('requirements');
         $jobs->benefits = $this->request->getPost('benefits');
         $jobs->salary_from = $this->request->getPost('salary_from');
         $jobs->salary_to = $this->request->getPost('salary_to');
         $jobs->company = $this->request->getPost('company');
         $jobs->website = $this->request->getPost('website');
         $jobs->telephone = $this->request->getPost('telephone');
         $jobs->email = $this->request->getPost('email');
         $jobs->street = $this->request->getPost('street');
         $jobs->city = $this->request->getPost('city');
         $jobs->country_id = $this->request->getPost('country_id');
         $jobs->how_to_apply = $this->request->getPost('how_to_apply');
         if ($jobs->create()) {
             $id = $jobs->id;
             $this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>New job has been created');
             if ($this->request->hasFiles() == true) {
                 set_time_limit(1200);
                 $uploads = $this->request->getUploadedFiles();
                 $isUploaded = false;
                 #do a loop to handle each file individually
                 foreach ($uploads as $upload) {
                     #define a “unique” name and a path to where our file must go
                     $fileName = $upload->getname();
                     $fileInfo = new SplFileInfo($fileName);
                     $fileExt = $fileInfo->getExtension();
                     $fileExt = strtolower($fileExt);
                     $newFileName = substr(md5(uniqid(rand(), true)), 0, 10) . date('ymdhis') . '.' . $fileExt;
                     //$fileExt = $upload->getExtension();
                     $fileImageExt = array('jpeg', 'jpg', 'png');
                     //error_log("File Extension :".$fileExt, 0);
                     $fileType = '';
                     $filePath = '';
                     $path = '';
                     //$path = ''.$newFileName;
                     if (in_array($fileExt, $fileImageExt)) {
                         $path = 'img/job/' . $newFileName;
                         $filePath = 'img/job/';
                         //$fileType = 'Image';
                     }
                     #move the file and simultaneously check if everything was ok
                     $upload->moveTo($path) ? $isUploaded = true : ($isUploaded = false);
                 }
                 #if any file couldn't be moved, then throw an message
                 if ($isUploaded) {
                     $jobLogos = new JobLogos();
                     $jobLogos->created = date('Y-m-d H:i:s');
                     $jobLogos->modified = date('Y-m-d H:i:s');
                     $jobLogos->member_id = $userSession['id'];
                     $jobLogos->job_id = $id;
                     $jobLogos->file_path = $filePath;
                     $jobLogos->filename = $newFileName;
                     if ($jobLogos->create()) {
                     }
                 }
             }
             return $this->response->redirect('job/view/' . $id);
         }
     }
     $member = Members::findFirst($userSession['id']);
     $this->view->setVar('member', $member);
     $countries = Countries::find();
     $this->view->setVar('countries', $countries);
     $jobCategories = JobCategories::find();
     $this->view->setVar('jobCategories', $jobCategories);
 }
开发者ID:hinjanobara,项目名称:mbimages,代码行数:89,代码来源:JobController.php

示例3: T_

 $extproj->addIssue($extTasksCatLeave, $task_sickleave, T_("Sick"), 90);
 // Create default jobs
 // Note: Support & N/A jobs already created by SQL file
 // Note: N/A job association to ExternalTasksProject already done in Install::createExternalTasksProject()
 echo "DEBUG 13/16 Create default jobs<br/>";
 if ($isJob2) {
     Jobs::create($job2, Job::type_commonJob, $job2_color);
 }
 if ($isJob3) {
     Jobs::create($job3, Job::type_commonJob, $job3_color);
 }
 if ($isJob4) {
     Jobs::create($job4, Job::type_commonJob, $job4_color);
 }
 if ($isJob5) {
     Jobs::create($job5, Job::type_commonJob, $job5_color);
 }
 // Set default Issue tooltip content
 echo "DEBUG 14/16 Set default content for Issue tooltip <br/>";
 $customField_type = Config::getInstance()->getValue(Config::id_customField_type);
 $backlogField = Config::getInstance()->getValue(Config::id_customField_backlog);
 $fieldList = array('project_id', 'category_id', 'custom_' . $customField_type, 'codevtt_elapsed', 'custom_' . $backlogField, 'codevtt_drift');
 $serialized = serialize($fieldList);
 Config::setValue('issue_tooltip_fields', $serialized, Config::configType_string, 'fields to be displayed in issue tooltip');
 // Add custom fields to existing projects
 echo "DEBUG 15/16 Prepare existing projects<br/>";
 if (isset($_POST['projects']) && !empty($_POST['projects'])) {
     $selectedProjects = $_POST['projects'];
     foreach ($selectedProjects as $projectid) {
         $project = ProjectCache::getInstance()->getProject($projectid);
         echo "DEBUG prepare project: " . $project->getName() . "<br/>";
开发者ID:fg-ok,项目名称:codev,代码行数:31,代码来源:install_step3.php

示例4: newAction

 public function newAction()
 {
     if ($this->request->isPost()) {
         $userSession = $this->session->get("userSession");
         $jobs = new Jobs();
         $jobs->created = date('Y-m-d H:i:s');
         $jobs->modified = date('Y-m-d H:i:s');
         $jobs->member_id = $userSession['id'];
         $jobs->position = $this->request->getPost('position');
         $jobs->job_category_id = $this->request->getPost('job_category_id');
         $jobs->job_description = $this->request->getPost('job_description');
         $jobs->requirements = $this->request->getPost('requirements');
         $jobs->benefits = $this->request->getPost('benefits');
         $jobs->salary_from = $this->request->getPost('salary_from');
         $jobs->salary_to = $this->request->getPost('salary_to');
         $jobs->company = $this->request->getPost('company');
         $jobs->website = $this->request->getPost('website');
         $jobs->telephone = $this->request->getPost('telephone');
         $jobs->email = $this->request->getPost('email');
         $jobs->street = $this->request->getPost('street');
         $jobs->city = $this->request->getPost('city');
         $jobs->country_id = $this->request->getPost('country_id');
         $jobs->how_to_apply = $this->request->getPost('how_to_apply');
         if ($jobs->create()) {
             $id = $jobs->id;
             $this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>New job has been created');
             return $this->response->redirect('job/view/' . $id);
         }
     }
     $countries = Countries::find();
     $this->view->setVar('countries', $countries);
     $jobCategories = JobCategories::find();
     $this->view->setVar('jobCategories', $jobCategories);
 }
开发者ID:hinjanobara,项目名称:mbimages,代码行数:34,代码来源:JobController.php


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