本文整理汇总了PHP中Job::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::setName方法的具体用法?PHP Job::setName怎么用?PHP Job::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job::setName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: installJobs
function installJobs()
{
global $jobsData, $jobs;
foreach ($jobsData as $jobTitle) {
$job = new Job();
$job->setName($jobTitle);
$jobs[$jobTitle] = $job;
}
}
示例2: execute
protected function execute($arguments = array(), $options = array())
{
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
// create connection to import database
$this->logSection('connection', 'creating connection to import source');
$source = Propel::getConnection($options['source'] ? $options['source'] : null);
// create static counties and offices
$this->logSection('static', 'creating static counties and offices');
$connection->beginTransaction();
try {
OfficePeer::doDeleteAll($connection);
$o1 = new Office();
$o1->setName('Plattsburgh');
$o1->save($connection);
$o1 = new Office();
$o1->setName('Rouses Point');
$o1->save($connection);
CountyPeer::doDeleteAll($connection);
$c1 = new County();
$c1->setName('Clinton');
$c1->save($connection);
$c1 = new County();
$c1->setName('Essex');
$c1->save($connection);
$connection->commit();
} catch (PropelException $e) {
$connection->rollBack();
throw $e;
}
// read in and create objects for district, frequency, icd9, job, services tables
// DISTRICT
$query = 'SELECT * FROM %s';
$query = sprintf($query, 'tbl_district');
$statement = $source->prepare($query);
$statement->execute();
$districts = $statement->fetchAll();
$connection->beginTransaction();
try {
DistrictPeer::doDeleteAll($connection);
foreach ($districts as $district) {
$this->logSection('district', 'creating district ' . $district['district_name']);
$d1 = new District();
$d1->setName($district['district_name']);
$d1->save($connection);
}
$connection->commit();
} catch (PropelException $e) {
$connection->rollBack();
throw $e;
}
// FREQUENCY
$query = 'SELECT * FROM %s';
$query = sprintf($query, 'tbl_frequency');
$statement = $source->prepare($query);
$statement->execute();
$frequencies = $statement->fetchAll();
$connection->beginTransaction();
try {
FrequencyPeer::doDeleteAll($connection);
foreach ($frequencies as $freq) {
$this->logSection('freq', 'reading frequency ' . $freq['freq_title']);
$f1 = new Frequency();
$f1->setName($freq['freq_title']);
$f1->setDescription($freq['freq_description']);
$f1->save($connection);
}
$connection->commit();
} catch (PropelException $e) {
$connection->rollBack();
throw $e;
}
// ICD9
$query = 'SELECT * FROM %s';
$query = sprintf($query, 'tbl_icd9');
$statement = $source->prepare($query);
$statement->execute();
$icd9s = $statement->fetchAll();
$connection->beginTransaction();
try {
Icd9Peer::doDeleteAll($connection);
foreach ($icd9s as $icd9) {
$this->logSection('icd9', 'reading icd9 ' . $icd9['icd9_value']);
$i1 = new Icd9();
$i1->setName($icd9['icd9_value']);
$i1->save($connection);
}
$connection->commit();
} catch (PropelException $e) {
$connection->rollBack();
throw $e;
}
// JOB
$query = 'SELECT * FROM %s';
$query = sprintf($query, 'tbl_job');
$statement = $source->prepare($query);
$statement->execute();
$jobs = $statement->fetchAll();
$connection->beginTransaction();
//.........这里部分代码省略.........
示例3: addFileToQueue
/**
* @param $queue_id int
* @param $file StorageInterface
* @return Job
*/
public static function addFileToQueue($queue_id, $file)
{
$sortSQL = "SELECT max(id)+1 FROM jobs WHERE user_id = ?";
$sort = db()->getValue($sortSQL, array(User::$me->id));
// Special case for first sort value
if ($sort == "") {
$sort = 1;
}
$job = new Job();
$job->set('user_id', User::$me->id);
$job->set('queue_id', $queue_id);
$job->set('source_file_id', $file->id);
if ($file->isGCode()) {
$job->set('file_id', $file->id);
}
if ($file->isMakerbot()) {
$job->set('file_id', $file->id);
}
$job->setName($file->get('path'));
$job->setStatus('available');
$job->set('created_time', date("Y-m-d H:i:s"));
$job->set('user_sort', $sort);
$job->save();
return $job;
}
示例4: executeMenu
public function executeMenu()
{
$group = $this->getContext()->getUser()->getAttribute('group', null, 'bo');
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
$employee = EmployeePeer::retrieveByPK($employee_id);
var_dump($employee);
die;
$code = $this->getRequest()->getParameter('code');
if ($code == 'acm') {
#if ($group == 'admin' || $group == 'root') {
if ($group == 'root') {
$jobs = array();
$job = new Job();
$job->setName('Modul');
$job->setCode('job');
$job->child = 0;
array_push($jobs, $job);
$job = new Job();
$job->setName('Parameters');
$job->setCode('params');
$job->child = 0;
array_push($jobs, $job);
$job = new Job();
$job->setName('Template Koleksi');
$job->setCode('cat_template');
$job->child = 0;
array_push($jobs, $job);
$job = new Job();
$job->setName('Template Menu');
$job->setCode('menu_template');
$job->child = 0;
array_push($jobs, $job);
} else {
$this->forward('default', 'index');
}
} elseif ($code == 'user' || $code == 'user_group' || $code == 'job') {
if ($group == 'admin' || $group == 'root') {
$this->forward($code, 'index');
} else {
$this->forward('default', 'index');
}
} else {
$c = new Criteria();
$c->addAscendingOrderByColumn('menu_order');
$c->add(JobPeer::CODE, $code);
$parent = JobPeer::doSelectOne($c);
$c = new Criteria();
$c->add(JobPeer::PARENT, $parent->getId());
$c->addJoin(JobPeer::ID, AclPeer::JOB_ID, Criteria::JOIN);
$c->addJoin(AclPeer::USER_GROUP_ID, UserGroupPeer::ID, Criteria::JOIN);
$c->add(UserGroupPeer::ID, $group_id, Criteria::EQUAL);
$c->add(JobPeer::DISPLAY_MENU, true);
$jobs = JobPeer::doSelect($c);
// restrict some access to iglobal only
$jobs0 = array();
$user = $this->getUser()->getAttribute('username', null, 'bo');
for ($i = 0; $i < count($jobs); ++$i) {
if ($user == 'iglobal' || $user == 'syarif') {
$jobs0[count($jobs0)] = $jobs[$i];
} else {
if ($jobs[$i]->getCode() != 'sm_check' && $jobs[$i]->getCode() != 'sm_template') {
$jobs0[count($jobs0)] = $jobs[$i];
}
}
}
$jobs = $jobs0;
foreach ($jobs as $job) {
$c = new Criteria();
$c->add(JobPeer::PARENT, $job->getId());
$c->add(JobPeer::DISPLAY_MENU, true);
$job->child = JobPeer::doCount($c);
}
}
$this->jobs = $jobs;
$this->type = $this->getRequest()->getParameter('get');
}
示例5: Job
require_once 'Human.php';
require_once 'WebSite.php';
require_once 'Newspaper.php';
$job = new Job();
$job->setName('Программист');
$job->setSalary(1000);
$human = new Human();
$newspaper = new Newspaper();
$webSite = new WebSite();
$recruitmentAgency = new RecruitmentAgency();
$recruitmentAgency->registerObserver($human);
$recruitmentAgency->registerObserver($newspaper);
$recruitmentAgency->registerObserver($webSite);
$recruitmentAgency->setJob($job);
/*
Итог:
Человек получил обновление о новой вакансии Программист с зарплатой 1000 USD
Газета получила обновление о новой вакансии Программист с зарплатой 1000 USD
Веб-сайт получил обновление о новой вакансии Программист с зарплатой 1000 USD
*/
// Исключаем человека из рассылки, видимо, он нашел работу по прошлому уведомлению о вакансии :)
$recruitmentAgency->removeObserver($human);
$job = new Job();
$job->setName('Менеджер');
$job->setSalary(800);
$recruitmentAgency->setJob($job);
/*
Итог:
Газета получила обновление о новой вакансии Менеджер с зарплатой 800 USD
Веб-сайт получил обновление о новой вакансии Менеджер с зарплатой 800 USD
*/