本文整理汇总了PHP中JobPeer::doCount方法的典型用法代码示例。如果您正苦于以下问题:PHP JobPeer::doCount方法的具体用法?PHP JobPeer::doCount怎么用?PHP JobPeer::doCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JobPeer
的用法示例。
在下文中一共展示了JobPeer::doCount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transformJobs
//.........这里部分代码省略.........
}
}
if (is_null($endTime)) {
$endTime = $shootEnd;
}
if (is_null($startTime)) {
$startTime = $shootStart;
}
if ($j->getCity() == "Boston") {
$j->setZip("02101");
} else {
$j->setZip("02155");
}
$j->setNotes($notes);
$j->setState("Massachusetts");
list($hour, $min, $sec) = explode(":", $endTime);
list($shour, $smin, $ssec) = explode(":", $startTime);
$t = new DateTime();
$t->setTime($hour, $min, $sec);
$j->setEndTime($t);
$t = new DateTime();
$t->setTime($shour, $smin, $ssec);
$j->setStartTime($t);
$j->addTag($slug);
if (isset($this->jobProjectKeys[$jid])) {
$j->setProjectId($this->projectKeys[$this->jobProjectKeys[$jid]]);
}
while (count($jobList) - 1 != $jid) {
$jobList[] = false;
}
$jobList[intval($jid)] = array("job" => $j, "del" => $del, "photog" => $photog);
}
for ($i = 1; $i < count($jobList); $i++) {
sleep(1);
$obj = $jobList[$i];
$c = new Criteria();
$c->add(JobPeer::ID, $i);
if (JobPeer::doCount($c) > 0) {
continue;
}
echo $i . "/" . $total . "\n";
// keep the ids lined up
if ($obj == false) {
$myJob = new Job();
try {
$myJob->save();
} catch (Exception $ex) {
echo $ex->getMessage();
}
$myJob->delete();
} else {
$j = $obj["job"];
$del = $obj["del"];
$photog = $obj["photog"];
try {
$j->save();
} catch (Exception $ex) {
echo $ex->getMessage();
echo $ex->getTraceAsString();
}
$del->setJobId($j->getId());
$del->save();
$this->jobKeys[$jid] = $j->getId();
if ($photog) {
$jp = new JobPhotographer();
$jp->setPhotographerId($this->photogKeys[$photog]);
$jp->setJobId($j->getId());
try {
$jp->save();
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
// add the requester as a client
$c = new Criteria();
$c->add(sfGuardUserPeer::USERNAME, $j->getContactEmail());
if (ClientPeer::doCount($c) == 0 && trim(strlen($j->getContactEmail())) != 0) {
$user = new sfGuardUser();
$user->setUsername($j->getContactEmail());
$user->setPassword("admin");
$user->save();
$userProfile = new sfGuardUserProfile();
$userProfile->setUserId($user->getId());
$userProfile->setUserTypeId(sfConfig::get("app_user_type_client"));
$userProfile->save();
$clientProfile = new Client();
$clientProfile->setUserId($userProfile->getId());
$clientProfile->setName($j->getContactName());
$clientProfile->setEmail($j->getContactEmail());
$clientProfile->setPhone($j->getContactPhone());
$clientProfile->save();
$jobClient = new JobClient();
$jobClient->setClientId($clientProfile->getId());
$jobClient->setJobId($j->getId());
$jobClient->save();
}
}
$count += 1;
}
}
示例2: getNumberOfJobs
public function getNumberOfJobs()
{
$c = new Criteria();
$c->add(JobPeer::PROJECT_ID, $this->getId());
return JobPeer::doCount($c);
}
示例3: executeEdit
public function executeEdit()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$c = new Criteria();
$c->add(JobPeer::CODE, $this->getModuleName());
$job = JobPeer::doSelectOne($c);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$this->can_add = $acl->getAddPriv() == 1;
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$user_group = UserGroupPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($user_group);
if ($user_group->getJobTemplateId() == 11) {
$c = new Criteria();
$cton1 = $c->getNewCriterion(JobPeer::ID, 132, Criteria::NOT_IN);
$cton2 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, 1, Criteria::IN);
$cton3 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, 3, Criteria::IN);
$cton4 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, 11, Criteria::IN);
$cton3->addOr($cton4);
$cton2->addOr($cton3);
$cton1->addAnd($cton2);
$c->add($cton1);
$c->addAscendingOrderByColumn(JobPeer::MENU_ORDER);
$jobs = JobPeer::doSelect($c);
} else {
$c = new Criteria();
$cton1 = $c->getNewCriterion(JobPeer::ID, 132, Criteria::NOT_IN);
$cton2 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, $user_group->getJobTemplateId(), Criteria::IN);
$cton3 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, $user_group->getJobTemplate()->getParent(), Criteria::IN);
$cton4 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, 11, Criteria::IN);
$cton3->addOr($cton4);
$cton2->addOr($cton3);
$cton1->addAnd($cton2);
$c->add($cton1);
$c->addAscendingOrderByColumn(JobPeer::MENU_ORDER);
$jobs = JobPeer::doSelect($c);
}
foreach ($jobs as $job) {
$c = new Criteria();
$c->add(JobPeer::PARENT, $job->getId());
$c->add(JobPeer::DISPLAY_MENU, true);
$job->child = JobPeer::doCount($c);
$c = new Criteria();
$c->add(AclPeer::USER_GROUP_ID, $user_group->getId(), Criteria::EQUAL);
$c->add(AclPeer::JOB_ID, $job->getId(), Criteria::EQUAL);
$job->acl = AclPeer::doSelectOne($c);
$job->level = $job->getLevel();
$job->order = $job->getMenuOrderRecursive();
}
$actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
if ($user_group->getCode() != 'admin' && $user_group->getCode() != 'student' && $user_group->getCode() != 'lector') {
array_push($actions, array('name' => 'delete', 'url' => 'user_group/delete?id=' . $user_group->getId(), 'color' => 'red'));
}
array_push($actions, array('name' => 'cancel', 'url' => 'user_group/list', 'color' => 'white'));
$this->subtitle = $user_group->toString() . ' - id:' . $user_group->getId();
$this->type = 'edit';
$this->user_group = $user_group;
$this->icon = 'user_edit.png';
$this->actions = $actions;
$this->jobs = $jobs;
}
示例4: countJobs
public function countJobs($criteria = null, $distinct = false, $con = null)
{
include_once 'lib/model/om/BaseJobPeer.php';
if ($criteria === null) {
$criteria = new Criteria();
} elseif ($criteria instanceof Criteria) {
$criteria = clone $criteria;
}
$criteria->add(JobPeer::JOB_TEMPLATE_ID, $this->getId());
return JobPeer::doCount($criteria, $distinct, $con);
}
示例5: foreach
<?php
$i = 0;
foreach ($rows as $job) {
$c = new Criteria();
$c->add(JobPeer::PARENT, $job->getId());
$job->child = JobPeer::doCount($c);
$code_level = '';
for ($i = 0; $i < $level; $i++) {
$code_level .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue();
}
?>
<tr id='job_<?php
echo $job->getId();
?>
' class="list<?php
++$i;
if ($i % 2 == 0) {
echo ' even';
}
?>
<?php
echo $parent_class;
?>
job_<?php
echo $parent_id;
?>
_child">
<td id='job_<?php
echo $job->getId();
?>
示例6: countJobs
/**
* Returns the number of related Job objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related Job objects.
* @throws PropelException
*/
public function countJobs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if ($criteria === null) {
$criteria = new Criteria(ProjectPeer::DATABASE_NAME);
} else {
$criteria = clone $criteria;
}
if ($distinct) {
$criteria->setDistinct();
}
$count = null;
if ($this->collJobs === null) {
if ($this->isNew()) {
$count = 0;
} else {
$criteria->add(JobPeer::PROJECT_ID, $this->id);
$count = JobPeer::doCount($criteria, $con);
}
} else {
// criteria has no effect for a new object
if (!$this->isNew()) {
// the following code is to determine if a new query is
// called for. If the criteria is the same as the last
// one, just return count of the collection.
$criteria->add(JobPeer::PROJECT_ID, $this->id);
if (!isset($this->lastJobCriteria) || !$this->lastJobCriteria->equals($criteria)) {
$count = JobPeer::doCount($criteria, $con);
} else {
$count = count($this->collJobs);
}
} else {
$count = count($this->collJobs);
}
}
return $count;
}
示例7: 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');
}