public static function retrieveByCode($code, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(JobPeer::DATABASE_NAME); $criteria->add(JobPeer::CODE, $code); $v = JobPeer::doSelect($criteria, $con); return !empty($v) > 0 ? $v[0] : null; }
public static function getJobsForAutocomplete($q) { sfContext::getInstance()->getConfiguration()->loadHelpers('Url'); $c = new Criteria(); $crit0 = $c->getNewCriterion(JobPeer::EVENT, $q . '%', Criteria::LIKE); $crit1 = $c->getNewCriterion(JobPeer::ID, $q . '%', Criteria::LIKE); $crit0->addOr($crit1); $c->add($crit0); $c->addDescendingOrderByColumn(JobPeer::EVENT); $c->setLimit(10); $jobs = JobPeer::doSelect($c); $arr = array(); foreach ($jobs as $j) { $arr[] = array("name" => $j->getId() . " - " . $j->getEvent(), "url" => url_for('job_show', array("slug" => $j->getSlug()))); } return $arr; }
public function executeChartEmployees() { $data = array(); foreach (JobPeer::doSelect(new Criteria()) as $job) { $c = new Criteria(); $c->add(EmployeePeer::JOB_ID, $job->getId()); $data[$job->getName()] = EmployeePeer::doCount($c); } //To create a bar chart we need to create a stBarOutline Object $bar = new stBarOutline(80, '#78B9EC', '#3495FE'); $bar->key('', 10); //Passing the random data to bar chart $bar->data = $data; //Creating a stGraph object $g = new stGraph(); $g->title('Employee Job Type Break-Down', '{font-size: 20px;}'); $g->bg_colour = '#FFFFFF'; $g->set_inner_background('#E3F0FD', '#CBD7E6', 90); $g->x_axis_colour('#8499A4', '#E4F5FC'); $g->y_axis_colour('#8499A4', '#E4F5FC'); //Pass stBarOutline object i.e. $bar to graph $g->data_sets[] = $bar; //Setting labels for X-Axis $g->set_x_labels(array_keys($data)); // to set the format of labels on x-axis e.g. font, color, step $g->set_x_label_style(10, '#18A6FF', 0, 2); // To tick the values on x-axis // 2 means tick every 2nd value $g->set_x_axis_steps(2); //set maximum value for y-axis //we can fix the value as 20, 10 etc. //but its better to use max of data $g->set_y_max(max($data)); $g->y_label_steps(4); $g->set_y_legend('# Employees', 12, '#18A6FF'); echo $g->render(); return sfView::NONE; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @return Job[] * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(JobPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(JobPeer::DATABASE_NAME); $criteria->add(JobPeer::ID, $pks, Criteria::IN); $objs = JobPeer::doSelect($criteria, $con); } return $objs; }
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; $budget_status = BudgetStatusPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($budget_status); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'budget_status/delete?id=' . $budget_status->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'budget_status/list', 'color' => 'white')); $this->subtitle = $budget_status->toString() . ' - id:' . $budget_status->getId(); $this->type = 'edit'; $this->budget_status = $budget_status; $this->actions = $actions; $cw = new Criteria(); $cw->add(JobPeer::PARENT, 240); $parent = JobPeer::doSelectOne($cw); $cr = new Criteria(); $cton1 = $cr->getNewCriterion(JobPeer::PARENT, $parent->getParent(), Criteria::IN); $cton2 = $cr->getNewCriterion(JobPeer::ID, $job->getId(), Criteria::NOT_IN); $cton3 = $cr->getNewCriterion(JobPeer::CODE, 'academic_process', Criteria::NOT_IN); $cton4 = $cr->getNewCriterion(JobPeer::CODE, 'payer_type', Criteria::NOT_IN); $cton5 = $cr->getNewCriterion(JobPeer::CODE, 'payment_model', Criteria::NOT_IN); $cton6 = $cr->getNewCriterion(JobPeer::CODE, 'budget_category', Criteria::NOT_IN); $cton5->addAnd($cton6); $cton4->addAnd($cton5); $cton3->addAnd($cton4); $cton2->addAnd($cton3); $cton1->addAnd($cton2); $cr->add($cton1); $modules = JobPeer::doSelect($cr); $this->modules = $modules; $actions2 = array(array('name' => '<span>Komponen Biaya Sekolah</span>', 'url' => 'academic_cost_component/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Proses Akademik</span>', 'url' => 'academic_process/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Tipe Siswa</span>', 'url' => 'payer_type/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Model Pembayaran</span>', 'url' => 'payment_model/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Kategori Anggaran</span>', 'url' => 'budget_category/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>' . $job->getName() . '</span>', 'url' => $job->getCode(), 'color' => 'sun', 'type' => 'direct')); $this->actions2 = $actions2; }
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; }
public function executeEdit() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $jobs = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $jobs->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; $job = JobPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($job); $c = new Criteria(); $c->add(JobInformationPeer::JOB_ID, $job->getId()); $job_information = JobInformationPeer::doSelectOne($c); if ($job_information) { $this->job_information = $job_information; } else { $this->job_information = new JobInformation(); } $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'job_information/delete?id=' . $job->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'job_information/list', 'color' => 'white')); $this->subtitle = $job->toString() . ' - id:' . $job->getId(); $this->type = 'edit'; $this->job = $job; $this->actions = $actions; $cw = new Criteria(); $cw->add(JobPeer::PARENT, 1078); $cw->addAscendingOrderByColumn('menu_order'); $parent = JobPeer::doSelectOne($cw); $cr = new Criteria(); $cton1 = $cr->getNewCriterion(JobPeer::PARENT, $parent->getParent(), Criteria::IN); $cton2 = $cr->getNewCriterion(JobPeer::ID, $jobs->getId(), Criteria::NOT_IN); $cton3 = $cr->getNewCriterion(JobPeer::CODE, 'public_information_category/list', Criteria::NOT_IN); $cton4 = $cr->getNewCriterion(JobPeer::CODE, 'public_information/listArticle', Criteria::NOT_IN); $cton5 = $cr->getNewCriterion(JobPeer::CODE, 'job_information/list', Criteria::NOT_IN); $cton6 = $cr->getNewCriterion(JobPeer::CODE, 'job_category', Criteria::NOT_IN); $cton5->addAnd($cton6); $cton4->addAnd($cton5); $cton3->addAnd($cton4); $cton2->addAnd($cton3); $cton1->addAnd($cton2); $cr->add($cton1); $modules = JobPeer::doSelect($cr); $this->modules = $modules; $actions2 = array(array('name' => '<span>Kategori Artikel</span>', 'url' => 'job_category/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Artikel Web</span>', 'url' => 'public_information/listArticle', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Kategori Menu</span>', 'url' => 'job_category/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>' . $jobs->getName() . '</span>', 'url' => $jobs->getCode(), 'color' => 'sun', 'type' => 'direct')); $this->actions2 = $actions2; }
public function getJobs($criteria = null, $con = null) { include_once 'lib/model/om/BaseJobPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collJobs === null) { if ($this->isNew()) { $this->collJobs = array(); } else { $criteria->add(JobPeer::JOB_TEMPLATE_ID, $this->getId()); JobPeer::addSelectColumns($criteria); $this->collJobs = JobPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(JobPeer::JOB_TEMPLATE_ID, $this->getId()); JobPeer::addSelectColumns($criteria); if (!isset($this->lastJobCriteria) || !$this->lastJobCriteria->equals($criteria)) { $this->collJobs = JobPeer::doSelect($criteria, $con); } } } $this->lastJobCriteria = $criteria; return $this->collJobs; }
public function executeGetChild() { $group = $this->getContext()->getUser()->getAttribute('group', null, 'bo'); if ($group != 'root') { $this->forward('default', 'index'); } $id = $this->getRequestParameter('id'); $this->forward404Unless($id); $level = $this->getRequestParameter('level'); if ($level == null) { $level = 0; } $c = new Criteria(); $c->add(JobPeer::PARENT, $id); $c->addAscendingOrderByColumn(JobPeer::MENU_ORDER); $this->rows = JobPeer::doSelect($c); $this->level = $level + 1; $this->parent_id = $id; $this->parent_class = $this->getRequestParameter('parent_class'); }
/** * Gets an array of Job objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Project has previously been saved, it will retrieve * related Jobs from storage. If this Project is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array Job[] * @throws PropelException */ public function getJobs($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(ProjectPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collJobs === null) { if ($this->isNew()) { $this->collJobs = array(); } else { $criteria->add(JobPeer::PROJECT_ID, $this->id); JobPeer::addSelectColumns($criteria); $this->collJobs = JobPeer::doSelect($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 the collection. $criteria->add(JobPeer::PROJECT_ID, $this->id); JobPeer::addSelectColumns($criteria); if (!isset($this->lastJobCriteria) || !$this->lastJobCriteria->equals($criteria)) { $this->collJobs = JobPeer::doSelect($criteria, $con); } } } $this->lastJobCriteria = $criteria; return $this->collJobs; }
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; $facility = FacilityPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($facility); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'facility/delete?id=' . $facility->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'facility/list', 'color' => 'black')); $this->subtitle = $facility->toString() . ' - id:' . $facility->getId(); $this->type = 'edit'; $this->facility = $facility; $this->actions = $actions; $cw = new Criteria(); $cw->add(JobPeer::PARENT, 242); $parent = JobPeer::doSelectOne($cw); $cr = new Criteria(); $cton1 = $cr->getNewCriterion(JobPeer::PARENT, $parent->getParent(), Criteria::IN); $cton2 = $cr->getNewCriterion(JobPeer::ID, $job->getId(), Criteria::NOT_IN); $cton3 = $cr->getNewCriterion(JobPeer::CODE, 'location_condition', Criteria::NOT_IN); $cton2->addAnd($cton3); $cton1->addAnd($cton2); $cr->add($cton1); $modules = JobPeer::doSelect($cr); $this->modules = $modules; $actions2 = array(array('name' => '<span>Kategori Ruangan</span>', 'url' => 'location_category/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Kondisi Ruangan</span>', 'url' => 'location_condition/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>' . $job->getName() . '</span>', 'url' => $job->getCode(), 'color' => 'sun', 'type' => 'direct')); $this->actions2 = $actions2; }
<?php $c = new Criteria(); $c->add(JobPeer::PARENT, 1071, Criteria::IN); $c->add(JobPeer::DISPLAY_MENU, true); $c->addAscendingOrderByColumn('menu_order'); $jobs = JobPeer::doSelect($c); ?> <div style="margin:29px 0 0 104px;float:left;width:160px;text-align:left;color:#fff;"> <ul id="menubanner" class="menubanner"> <li class="active item12" id="current"><a href="/"><span>Home</span></a></li> <?php foreach ($jobs as $job) { ?> <li class="item"> <?php echo link_to_remote(__($job->getName()), array('update' => 'content', 'script' => 'true', 'url' => '/' . $job->getCode(), 'after' => 'document.getElementsByClassName(\'active_main_menu\').each(function(node){node.removeClassName(\'active_main_menu\');});$(this.parentNode).addClassName(\'active_main_menu\')', 'success' => visual_effect('fade', 'sub_menu') . visual_effect('fade', 'child_menu') . visual_effect('fade', 'grandchild_menu'))); ?> </li> <?php } ?> </ul> </div>
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; $academic_cost_component = AcademicCostComponentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($academic_cost_component); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'academic_cost_component/delete?id=' . $academic_cost_component->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'academic_cost_component/list', 'color' => 'black')); $this->subtitle = $academic_cost_component->toString() . ' - id:' . $academic_cost_component->getId(); $this->type = 'edit'; $this->academic_cost_component = $academic_cost_component; $this->actions = $actions; $cw = new Criteria(); $cw->add(JobPeer::PARENT, $job->getId()); $modules = JobPeer::doSelect($cw); $this->modules = $modules; $actions2 = array(array('name' => '<span>Komponen Biaya Sekolah</span>', 'url' => $job->getCode(), 'color' => 'sun', 'type' => 'direct')); $this->actions2 = $actions2; }
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'); }
<?php error_reporting(E_ALL); include_once "../../config/ProjectConfiguration.class.php"; $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true); $sfContext = sfContext::createInstance($configuration); $c = new Criteria(); $c->add(JobPeer::DATE, null, Criteria::NOT_EQUAL); $c->addDescendingOrderByColumn(JobPeer::ID); foreach (JobPeer::doSelect($c) as $job) { try { $job->save(); } catch (Exception $ex) { echo $ex->getMessage(); } echo $job->getId() . "\n"; sleep(60); } die; /* $u = new sfGuardUser(); $u->setPassword("asdfasdf"); $u->setUsername("adatta02"); $u->save(); $c = new Criteria(); // $c->add(JobPeer::G_CAL_ID, null); foreach( JobPeer::doSelect( $c ) as $job ){
public function executeAddTag(sfWebRequest $request) { $obj = json_decode($request->getParameter("obj"), true); $jobs = $obj["jobs"]; $tags = $obj["tags"]; $viewingJob = array_key_exists("viewingJob", $obj); $tags = preg_replace("/[^a-zA-Z0-9\\s]/", "", $tags); $c = new Criteria(); $c->add(JobPeer::ID, $jobs, Criteria::IN); $jobs = JobPeer::doSelect($c); foreach ($jobs as $j) { $j->addTag($tags); $j->save(); } if (!$viewingJob) { $this->setTemplate("reload"); if ($this->createCriteria() == sfView::NONE) { return sfView::NONE; } } else { $job = $jobs[0]; $this->renderPartial("basicInfo", array("job" => $job)); return sfView::NONE; } }