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


PHP Job::get方法代码示例

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


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

示例1: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if ($this->ID) {
         Session::set("FamilyMemberID", $this->ID);
     }
     if (Session::get("FamilyID")) {
         $this->FamilyID = Session::get("FamilyID");
         $fields->replaceField('FamilyID', new HiddenField('FamilyID'));
     }
     $dateOfBirth = new DateField('DateOfBirth', 'Date Of Birth');
     $dateOfBirth->setConfig('dateformat', 'dd-MM-yyyy');
     $dateOfBirth->setDescription('e.g. ' . date('d-m-Y'));
     $dateOfBirth->setAttribute('placeholder', 'dd-MM-yyyy');
     $fields->addFieldsToTab('Root.Main', $dateOfBirth);
     $genders = Config::inst()->get('FamilyMember', 'Gender');
     $gender = new OptionsetField("Gender", 'Gender', $genders);
     $fields->addFieldsToTab('Root.Main', $gender);
     $status = Config::inst()->get('FamilyMember', 'MartialStatus');
     $martialStatus = new OptionsetField("MartialStatus", 'Martial Status', $status);
     $fields->addFieldsToTab('Root.Main', $martialStatus);
     $fields->insertBefore(new Tab('Job', 'Job'), 'CommunityGroups');
     //Job GridField
     $jobGridFieldConfig = GridFieldConfig_RecordEditor::create();
     $jobList = Job::get()->filter(array('FamilyMemberID' => $this->ID))->sort('ID ASC');
     if ($jobList->count()) {
         $jobGridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
     }
     $jobGridField = new GridField('Job', 'Job', $jobList, $jobGridFieldConfig);
     $fields->addFieldsToTab('Root.Job', array($jobGridField));
     $fields->insertBefore(new Tab('Health', 'Health'), 'CommunityGroups');
     //Health GridField
     $healthGridFieldConfig = GridFieldConfig_RecordEditor::create();
     $healthList = Health::get()->filter(array('FamilyMemberID' => $this->ID))->sort('ID ASC');
     if ($healthList->count()) {
         $healthGridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
     }
     $healthGridField = new GridField('Health', 'Health', $healthList, $healthGridFieldConfig);
     $fields->addFieldsToTab('Root.Health', array($healthGridField));
     //Job GridField
     /*
     $communityGroupsCongfig = GridFieldConfig_RelationEditor::create();
     //$jobGridFieldConfig = GridFieldConfig_RecordEditor::create();
     $communityGroupsList = $this->CommunityGroups();
     $communityGroupsGridField = new GridField('CommunityGroups', 'Community Groups',
     	$communityGroupsList,
     	$communityGroupsCongfig);
     $fields->addFieldsToTab('Root.CommunityGroups', array(
     	$communityGroupsGridField
     ));
     */
     //CommunityGroups ListboxField
     $communityGroupsList = CommunityGroup::get()->map('ID', 'Title')->toArray();
     $communityGroupsField = new ListboxField($name = "CommunityGroups", $title = "Communtiy Groups", $communityGroupsList);
     $communityGroupsField->setMultiple(true);
     $fields->addFieldsToTab('Root.CommunityGroups', $communityGroupsField);
     //exit('dd');
     return $fields;
 }
开发者ID:thomaspaulson,项目名称:myparish,代码行数:59,代码来源:FamilyMember.php

示例2: doDeleteJobForm

 /**
  * Delete a given job
  *
  * @param array $data
  * @param Form $form
  */
 public function doDeleteJobForm($data, $form)
 {
     if (isset($data['JobID'])) {
         $job = Job::get()->byId($data['JobID']);
         // check user has permission
         if (!$job || $job->MemberID != Member::currentUserID() && !Permission::check('ADMIN')) {
             return Security::permissionFailure($this);
         }
         $job->isActive = false;
         $job->write();
     }
     return $this->redirect($this->Link('removed'));
 }
开发者ID:helpfulrobot,项目名称:fullscreeninteractive-silverstripe-jobboard,代码行数:19,代码来源:JobBoardFormProcessor.php

示例3: save

 function save($object = '', $related_field = '')
 {
     if (!$this->exists()) {
         $o = new Job();
         $o->select_max('position');
         $o->get();
         if (count($o->all) != 0) {
             $max = $o->position + 1;
             $this->position = $max;
         } else {
             $this->postion = 1;
         }
     }
     return parent::save($object, $related_field);
 }
开发者ID:lxthien,项目名称:batdongsan,代码行数:15,代码来源:job.php

示例4: _getBotData

 /**
  * @param Bot $bot
  * @param Job $job
  * @return array
  */
 private function _getBotData($bot, $job)
 {
     $botData = array();
     $botData['id'] = $bot->id;
     $botData['name'] = $bot->getName();
     $botData['status'] = $bot->getStatus();
     $botData['status_class'] = BotStatus::getStatusHTMLClass($bot);
     $botData['url'] = $bot->getUrl();
     $botData['last_seen'] = BotLastSeen::getHTML($bot);
     $webcam = $bot->getWebCamImage();
     if ($webcam->isHydrated()) {
         $botData['webcam_url'] = $webcam->getDownloadURL();
     } else {
         $botData['webcam_url'] = "/img/colorbars.gif";
     }
     $buttons = $this->_getStatusButtons($bot);
     $menu = array();
     $status = $bot->getStatus();
     if ($status == BotState::Working) {
         $menu[] = $buttons['pause'];
         $menu[] = $buttons['dropjob'];
         $menu[] = $buttons['edit'];
         $menu[] = $buttons['delete'];
     } else {
         if ($status == BotState::Paused) {
             $menu[] = $buttons['play'];
             $menu[] = $buttons['dropjob'];
             $menu[] = $buttons['edit'];
             $menu[] = $buttons['delete'];
         } else {
             if ($status == BotState::Slicing) {
                 $menu[] = $buttons['dropjob'];
                 $menu[] = $buttons['edit'];
                 $menu[] = $buttons['delete'];
             } else {
                 if ($status == BotState::Waiting) {
                     $menu[] = $buttons['qa'];
                     $menu[] = $buttons['edit'];
                     $menu[] = $buttons['delete'];
                 } else {
                     if ($status == BotState::Idle) {
                         $menu[] = $buttons['offline'];
                         $menu[] = $buttons['edit'];
                         $menu[] = $buttons['error'];
                         $menu[] = $buttons['delete'];
                     } else {
                         if ($status == BotState::Offline) {
                             $menu[] = $buttons['online'];
                             $menu[] = $buttons['edit'];
                             $menu[] = $buttons['error'];
                             $menu[] = $buttons['delete'];
                             $menu[] = $buttons['retire'];
                         } else {
                             if ($status == BotState::Maintenance) {
                                 $menu[] = $buttons['online'];
                                 $menu[] = $buttons['offline'];
                                 $menu[] = $buttons['edit'];
                                 $menu[] = $buttons['delete'];
                             } else {
                                 if ($status == BotState::Error) {
                                     $menu[] = $buttons['online'];
                                     $menu[] = $buttons['offline'];
                                     $menu[] = $buttons['edit'];
                                     $menu[] = $buttons['delete'];
                                 } else {
                                     if ($status == BotState::Retired) {
                                         $menu[] = $buttons['delete'];
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $botData['menu'] = $menu;
     if ($job->isHydrated()) {
         $jobData = array();
         $jobData['id'] = $job->id;
         $jobData['name'] = $job->getName();
         $jobData['url'] = $job->getUrl();
         $jobData['status'] = $job->get('status');
         $jobData['status_class'] = JobStatus::getStatusHTMLClass($job->get('status'));
         $jobData['elapsed'] = $job->getElapsedText();
         $jobData['estimated'] = $job->getEstimatedText();
         if ($job->get('status') == 'taken' || $job->get('status') == 'slicing') {
             $jobData['progress'] = round($job->get('progress'), 2);
             $jobData['bar_class'] = "";
         }
         $temps = JSON::decode($bot->get('temperature_data'));
         if ($bot->get('status') == BotState::Working && $temps !== NULL) {
             if (isset($temps->extruder)) {
                 $botData['temp_extruder'] = $temps->extruder;
             }
//.........这里部分代码省略.........
开发者ID:eric116,项目名称:BotQueue,代码行数:101,代码来源:main.php

示例5: start_retrieval_job

function start_retrieval_job(Job $job, DateTime $start_time)
{
    $oResult = client()->initiateJob(array('accountId' => '-', 'vaultName' => VAULT, 'ArchiveId' => $job->get('archive_id'), 'RetrievalByteRange' => $job->get('start') . "-" . $job->get('end'), 'Type' => 'archive-retrieval'));
    $job->set('start_time', $start_time);
    $job->set('running', 1);
    $job->set('jobId', $oResult->get('jobId'));
}
开发者ID:htesligte,项目名称:glacier-downloader,代码行数:7,代码来源:functions.php

示例6: Employer

if ($_POST['action'] == 'get_jobs') {
    $employer = new Employer($_POST['id']);
    $result = $employer->getJobs($_POST['order']);
    if (is_null($result) || empty($result)) {
        echo '0';
        exit;
    }
    if ($result === false) {
        echo 'ko';
        exit;
    }
    foreach ($result as $i => $row) {
        $result[$i]['title'] = htmlspecialchars_decode(stripslashes($row['title']));
    }
    header('Content-type: text/xml');
    echo $xml_dom->get_xml_from_array(array('jobs' => array('job' => $result)));
    exit;
}
if ($_POST['action'] == 'get_job') {
    $job = new Job($_POST['id']);
    $result = $job->get();
    $result[0]['title'] = htmlspecialchars_decode(stripslashes($result[0]['title']));
    $result[0]['description'] = htmlspecialchars_decode(stripslashes($result[0]['description']));
    $result[0]['description'] = str_replace('<br/>', "\n", $result[0]['description']);
    $criteria = array('columns' => "job_index.state", 'joins' => "job_index ON job_index.job = jobs.id", 'match' => "jobs.id = " . $_POST['id'], 'limit' => "1");
    $tmp = $job->find($criteria);
    $result[0]['state'] = $tmp[0]['state'];
    header('Content-type: text/xml');
    echo $xml_dom->get_xml_from_array(array('job' => $result));
    exit;
}
开发者ID:pamalite,项目名称:yel,代码行数:31,代码来源:employee_member_action.php

示例7: grabJob

 /**
  * @param $job Job
  * @param $can_slice bool
  * @return Job
  * @throws Exception
  */
 public function grabJob($job, $can_slice = true)
 {
     $grabAttemptSQL = "\n            UPDATE jobs\n            SET bot_id =\n              CASE\n                WHEN bot_id=0\n                THEN\n                  ?\n                ELSE\n                  bot_id\n              END\n            WHERE id = ?\n        ";
     // Attempt to grab the job unless another bot already has
     db()->execute($grabAttemptSQL, array($this->id, $job->id));
     $job = new Job($job->id);
     // Reload the job
     if ($job->get('bot_id') != $this->id) {
         // We didn't grab it in time.
         throw new Exception("Unable to lock job #{$job->id}");
     }
     $job->setStatus('taken');
     $job->set('taken_time', date('Y-m-d H:i:s'));
     $job->save();
     //do we need to slice this job?
     if (!$job->getFile()->isHydrated() && $can_slice) {
         //pull in our config and make sure it's legit.
         $config = $this->getSliceConfig();
         if (!$config->isHydrated()) {
             $job->setStatus('available');
             $job->set('bot_id', 0);
             $job->set('taken_time', 0);
             $job->save();
             throw new Exception("This bot does not have a slice engine + configuration set.");
         }
         //is there an existing slice job w/ this exact file and config?
         $sj = SliceJob::byConfigAndSource($config->id, $job->get('source_file_id'));
         if ($sj->isHydrated()) {
             //update our job status.
             $job->set('slice_job_id', $sj->id);
             $job->set('slice_complete_time', $job->get('taken_time'));
             $job->set('file_id', $sj->get('output_id'));
             $job->save();
         } else {
             //nope, create our slice job for processing.
             $sj->set('user_id', User::$me->id);
             $sj->set('job_id', $job->id);
             $sj->set('input_id', $job->get('source_file_id'));
             $sj->set('slice_config_id', $config->id);
             $sj->set('slice_config_snapshot', $config->getSnapshot());
             $sj->set('add_date', date("Y-m-d H:i:s"));
             $sj->setStatus('available');
             $sj->save();
             //update our job status.
             $job->setStatus('slicing');
             $job->set('slice_job_id', $sj->id);
             $job->save();
         }
     }
     $log = new JobClockEntry();
     $log->set('job_id', $job->id);
     $log->set('user_id', User::$me->id);
     $log->set('bot_id', $this->id);
     $log->set('queue_id', $job->get('queue_id'));
     $log->set('start_date', date("Y-m-d H:i:s"));
     $log->setStatus('working');
     $log->save();
     $this->set('job_id', $job->id);
     $this->setStatus(BotState::Working);
     $this->set('last_seen', date("Y-m-d H:i:s"));
     $this->save();
     return $job;
 }
开发者ID:JoonasMelin,项目名称:BotQueue,代码行数:69,代码来源:bot.php

示例8: JobDetailsPage

 function JobDetailsPage()
 {
     $job_id = intval($this->request->param('JOB_ID'));
     $job = Job::get()->byID($job_id);
     if ($job) {
         if (!empty($job->MoreInfoLink)) {
             $job->FormattedMoreInfoLink = $this->getViewInfoLink($job->MoreInfoLink);
         }
         return $this->renderWith(array('JobDetail', 'Page'), ['Job' => $job]);
     }
     return $this->httpError(404, 'Sorry that Job could not be found!.');
 }
开发者ID:hogepodge,项目名称:openstack-org,代码行数:12,代码来源:JobHolder.php

示例9: getUpdatedictionaries

 public function getUpdatedictionaries()
 {
     $jobs = Job::get();
     foreach ($jobs as $job) {
         foreach ($job->workerunits as $ann) {
             //$ann->type = $job->type;
             $ann->annotationVector = $ann->createWorkerunitVector();
             $ann->save();
         }
         Queue::push('Queues\\UpdateJob', array('job' => serialize($job)));
     }
 }
开发者ID:crowdtruth,项目名称:crowdtruth,代码行数:12,代码来源:tempImportAndVectorsMethodsController.php

示例10: fix_temp_data

<?php

include "../../extensions/global.php";
include "../patches.php";
$patchNumber = 12;
start_patch();
if (!patch_exists($patchNumber)) {
    // Fix the temperature fields:
    $rs = db()->query("SELECT * from jobs");
    while ($row = $rs->fetch(PDO::FETCH_ASSOC)) {
        $job = new Job($row['id']);
        $fixed_data = fix_temp_data($job->get('temperature_data'));
        $job->set('temperature_data', $fixed_data);
        $job->save();
    }
    $rs = db()->query("SELECT * from bots");
    while ($row = $rs->fetch(PDO::FETCH_ASSOC)) {
        $bot = new Bot($row['id']);
        $fixed_data = fix_temp_data($bot->get('temperature_data'));
        $bot->set('temperature_data', $fixed_data);
        $bot->save();
    }
    $expandTemperatureData = "\n\t\tALTER TABLE jobs\n  \t\tMODIFY COLUMN temperature_data longtext NOT NULL";
    db()->execute($expandTemperatureData);
    $expandTemperatureData = "\n\t\tALTER TABLE bots\n  \t\tMODIFY COLUMN temperature_data longtext NOT NULL";
    finish_patch($patchNumber, "Expanded temperature data fields");
}
function fix_temp_data($data)
{
    if (strlen($data) == 0) {
        return "";
开发者ID:JoonasMelin,项目名称:BotQueue,代码行数:31,代码来源:v04p0012.php

示例11: api_webcamupdate

 public function api_webcamupdate()
 {
     if ((int) $this->args('job_id')) {
         $job = new Job($this->args('job_id'));
         if (!$job->isHydrated()) {
             throw new Exception("Job does not exist.");
         }
         $bot = $job->getBot();
         if (!$bot->isHydrated()) {
             throw new Exception("Bot does not exist.");
         }
         if (!$job->getQueue()->isMine()) {
             throw new Exception("This job is not in your queue.");
         }
     } else {
         if ((int) $this->args('bot_id')) {
             $bot = new Bot($this->args('bot_id'));
             if (!$bot->isHydrated()) {
                 throw new Exception("Bot does not exist.");
             }
             $job = new Job();
         } else {
             throw new Exception("You must pass in either a bot or job id.");
         }
     }
     if (!$bot->isMine()) {
         throw new Exception("This is not your bot.");
     }
     if (!empty($_FILES['file']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
         //upload our file
         $file = $_FILES['file'];
         $this->ensureGoodFile($file);
         //does it match?
         if (!preg_match("/\\.jpg\$/i", $file['name'])) {
             throw new Exception("The file must end in .jpg");
         }
         //is it a real image?
         $size = getimagesize($file['tmp_name']);
         if (!$size[0] || !$size[1]) {
             throw new Exception("The file is not a valid image.");
         }
         //okay, we're good.. do it.
         if ($job->isHydrated()) {
             $data_file = Storage::newFile();
         } else {
             $data_file = $bot->getWebcamImage();
         }
         $data_file->set('user_id', User::$me->id);
         $data_file->upload($file['tmp_name'], StorageInterface::getNiceDir($file['name']));
         //if we have a job, save our new image.
         if ($job->isHydrated()) {
             $job->set('webcam_image_id', $data_file->id);
             $ids = json::decode($job->get('webcam_images'));
             if ($ids == NULL) {
                 $ids = array();
                 $ids[time()] = $data_file->id;
             } else {
                 $index = time();
                 $ids->{$index} = $data_file->id;
             }
             $job->set('webcam_images', json::encode($ids));
         }
         //always pull the latest image in for the bot.
         $bot->set('webcam_image_id', $data_file->id);
     } else {
         throw new Exception("No file uploaded.");
     }
     //did we get temperatures?
     $this->_updateTemperatures($this->args('temperatures'), $bot, $job);
     //update our job info.
     if ($this->args('progress') && $job->isHydrated()) {
         $job->set('progress', (double) $this->args('progress'));
     }
     //only save the job if its real.
     if ($job->isHydrated()) {
         $job->save();
     }
     //update our bot info
     $bot = $this->_markBotAsSeen($bot);
     //what kind of data to send back.
     if ($job->isHydrated()) {
         return $job->getAPIData();
     } else {
         return $bot->getAPIData();
     }
 }
开发者ID:JoonasMelin,项目名称:BotQueue,代码行数:86,代码来源:apiv1.php

示例12: getLoop

 public function getLoop()
 {
     foreach (Job::get() as $job) {
         //if(!isset($job->projectedCost)){
         try {
             $batch = $job->batch;
             $reward = $job->jobConfiguration->content['reward'];
             $workerunitsPerUnit = intval($job->jobConfiguration->content['workerunitsPerUnit']);
             $unitsPerTask = intval($job->jobConfiguration->content['unitsPerTask']);
             $unitsCount = count($batch->wasDerivedFrom);
             if (!$unitsPerTask) {
                 $unitsPerTask = 1;
             }
             $projectedCost = round($reward / $unitsPerTask * ($unitsCount * $workerunitsPerUnit), 2);
             $count = 0;
             foreach ($job->workerunits as $ann) {
                 $count++;
             }
             $job->realCost = $count * $reward;
             $job->unitsCount = $unitsCount;
             $job->projectedCost = $projectedCost;
             $job->save;
         } catch (LogicException $e) {
             echo $e->getMessage();
         }
         //}
     }
 }
开发者ID:harixxy,项目名称:CrowdTruth,代码行数:28,代码来源:JobsController.php

示例13: get

 /**
  * 获取属性
  *
  * @param string $key
  * @return mixed
  */
 public function get($key)
 {
     return parent::get($key);
 }
开发者ID:lezhizhe,项目名称:RedisQueue-as-like-beanstalkd,代码行数:10,代码来源:Invoker.php

示例14: update_sort

 public function update_sort()
 {
     $this->assertLoggedIn();
     if (!$this->args('jobs')) {
         die("Error: You didn't pass any jobs in.");
     }
     $jobs = explode(",", $this->args('jobs'));
     if (count($jobs) < 1) {
         die("Error: You need to pass in at least 2 jobs.");
     }
     //load up our ids.
     $jobIds = preg_filter('/^job_(\\d+)$/', '$1', $jobs);
     $jobs = array();
     // Only grab jobs that exist and are ours
     foreach ($jobIds as $id) {
         /** @var Job $job */
         $job = new Job($id);
         if ($job->isHydrated() && $job->isMine()) {
             $jobs[$id] = $job->get('user_sort');
         }
     }
     // Sort the values, but not the keys
     $values = array_values($jobs);
     sort($values);
     $jobs = array_combine(array_keys($jobs), $values);
     // Now actually update
     foreach ($jobs as $id => $sort) {
         /** @var Job $job */
         $job = new Job($id);
         $job->set('user_sort', $sort);
         $job->save();
     }
     die(print_r($jobs, true));
 }
开发者ID:eric116,项目名称:BotQueue,代码行数:34,代码来源:queue.php

示例15: count

$data['title'] = "Some lame job";
$data['description'] = "blahlelelll blah... some job descriptions goes here";
if ($job->create($data)) {
    echo "This job gets the ID of <b>" . $job->getId() . "</b><br><br>";
    print_array($job->get());
} else {
    echo "failed";
    exit;
}
?>
</p><p style="font-weight: bold;">Get all jobs... </p><p><?php 
$jobs = $job->find(array('columns' => 'id'));
echo "There are " . count($jobs) . " jobs in the database.<br><br>";
?>
</p><p style="font-weight: bold;">Update 1st job... </p><p><?php 
echo $first_job_id . '<br/>';
$job = new Job($first_job_id);
$data = array();
$data['country'] = 'HK';
$data['currency'] = 'HKD';
$data['salary'] = '5562';
$data['salary_negotiable'] = 'Y';
$data['description'] = "wllwh kwhhwf wpejf[w wopj blahlelelll blah... some job descriptions goes here";
if ($job->update($data)) {
    print_array($job->get());
} else {
    echo "failed";
    exit;
}
?>
</p>
开发者ID:pamalite,项目名称:yel,代码行数:31,代码来源:job.php


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