echo "ko"; exit; } $query = "SELECT expire_on \n FROM jobs \n WHERE id = " . $_POST['job'] . " LIMIT 1"; $result = $mysqli->query($query); $is_expired = sql_date_diff($result[0]['expire_on'], now()) <= 0 ? true : false; $expire_on = $result[0]['expire_on']; if ($is_expired) { $expire_on = now(); } $data = array(); $data['created_on'] = $expire_on; $data['expire_on'] = sql_date_add($data['created_on'], 30, 'day'); $data['closed'] = 'N'; $job = new Job($_POST['job']); if ($job->update($data) == false) { echo "ko"; exit; } echo "ok"; exit; } if ($_POST['action'] == 'get_contact_person') { $query = "SELECT contact_person, email_addr FROM employers WHERE id = '" . $_POST['id'] . "' LIMIT 1"; $mysqli = Database::connect(); $result = $mysqli->query($query); $response = array('contact' => $result[0]); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; }
/** * @group logbook */ public function testJobReviewed() { $jobid = 3; print "\n" . __METHOD__ . ' '; $this->_rootLogin(); $this->request->setPost(array('hiddenNew' => 1, 'reviewed' => 1, 'joberrors' => 1111, 'jobid' => $jobid, 'logDateCreate' => date("Y-m-d H:i:s", time()), 'logTxt' => __METHOD__ . "\nJob Reviewed", "test" => 1)); $this->request->setMethod('POST'); $this->dispatch('wblogbook/add'); $this->logBody($this->response->outputBody()); // debug log $this->assertController('wblogbook'); $this->assertAction('add'); //echo $this->response->outputBody();exit; // for debug !!! $this->assertRedirectTo('/wblogbook/index'); $this->resetRequest()->resetResponse(); // проверить есть ли запись в Job Zend_Loader::loadClass('Job'); $table = new Job(); $row = $table->fetchRow("JobId = {$jobid}"); if ($row->reviewed == 0) { $this->assertTrue(FALSE, "\nJob Reviewed fail!\n"); } if (!strpos($row->comment, 'Reviewed')) { $this->assertTrue(FALSE, "\nComment of Job Reviewed fail!\n"); } // проверить, что запись теперь не показывается в job/problem $this->dispatch('job/problem'); $this->logBody($this->response->outputBody(), 'a'); // debug log $this->assertModule('default'); $this->assertController('job'); $this->assertAction('problem'); $this->assertNotQueryContentRegex('table', self::ZF_pattern); // Zend Framework $this->assertResponseCode(200); $this->assertNotQueryContentContains('td', '/job/detail/jobid/3"'); // возвращаем все назад $data = array('Reviewed' => 0, 'Comment' => ''); $res = $table->update($data, "JobId = {$jobid}"); if (!$res) { $this->assertTrue(FALSE, "\nBackwards of Job Reviewed fail!\n"); } }
function myJobReviewed($jobid, $msg = '') { if ($jobid <= 0) { return; } Zend_Loader::loadClass('Job'); Zend_Loader::loadClass('Log'); if (empty($msg)) { $msg = $this->view->translate->_("Bacula Job Reviewed. See Webacula LOGBOOK_ID=" . $this->id_insert) . '.'; } // read Comment from Job table $table = new Job(); $where = $table->getAdapter()->quoteInto('JobId = ?', $jobid); $row = $table->fetchRow($where); if ($row) { $msg_job = $msg . "\n" . $row->comment; } else { $msg_job = $msg; } // change Job table $data = array('Reviewed' => 1, 'Comment' => $msg_job); $where = $table->getAdapter()->quoteInto('JobId = ?', $jobid); $res = $table->update($data, $where); if ($res) { $email = new MyClass_SendEmail(); // $from_email, $from_name, $to_email, $to_name, $subj, $body $email->mySendEmail($this->view->config->webacula->email->from, $this->view->translate->_('Webacula Logbook'), $this->view->config->webacula->email->to_admin, $this->view->translate->_('Webacula admin'), $this->view->translate->_('Bacula Job Reviewed'), $this->view->translate->_('Job Id') . " " . $jobid . "\n" . $msg_job); } unset($table); // add record in Log table $table = new Log(); $data = array('JobId' => $jobid, 'Time' => date("Y-m-d H:i:s", time()), 'LogText' => $msg); $table->insert($data); }
$data = array(); $data['id'] = $_POST['id']; $data['replacement_authorized_on'] = $today; if (!Referral::update($data)) { echo 'ko'; exit; } $query = "SELECT job FROM referrals WHERE id = " . $_POST['id'] . " LIMIT 1"; $mysqli = Database::connect(); $result = $mysqli->query($query); $data = array(); $data['expire_on'] = sql_date_add($today, 30, 'day'); $data['closed'] = 'N'; $data['for_replacement'] = 'Y'; $job = new Job($result[0]['job']); if (!$job->update($data)) { echo 'ko'; exit; } $query = "SELECT employers.name AS employer, industries.industry, jobs.title, \n referrals.member AS member_email_addr, referrals.referee AS referee_email_addr, \n CONCAT(members.lastname, ', ', members.firstname) AS member, \n CONCAT(referees.lastname, ', ', referees.firstname) AS referee, \n DATE_FORMAT(referrals.referred_on, '%e %b, %Y') AS formatted_referred_on, \n DATE_FORMAT(referrals.employed_on, '%e %b, %Y') AS formatted_employed_on, \n DATE_FORMAT(referrals.replacement_authorized_on, '%e %b, %Y') AS formatted_replacement_authorized_on \n FROM referrals \n LEFT JOIN jobs ON jobs.id = referrals.job \n LEFT JOIN employers ON employers.id = jobs.employer \n LEFT JOIN industries ON industries.id = jobs.industry \n LEFT JOIN members ON members.email_addr = referrals.member \n LEFT JOIN members AS referees ON referees.email_addr = referrals.referee \n WHERE referrals.id = " . $_POST['id'] . " LIMIT 1"; $result = $mysqli->query($query); $lines = file(dirname(__FILE__) . '/../private/mail/member_replacement.txt'); $message = ''; foreach ($lines as $line) { $message .= $line; } $message = str_replace('%member%', htmlspecialchars_decode($result[0]['member']), $message); $message = str_replace('%job_title%', htmlspecialchars_decode($result[0]['title']), $message); $message = str_replace('%employer%', htmlspecialchars_decode($result[0]['employer']), $message); $message = str_replace('%industry%', $result[0]['industry'], $message); $message = str_replace('%candidate%', htmlspecialchars_decode($result[0]['referee']), $message);
$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>
<?php require_once dirname(__FILE__) . "/../../private/lib/utilities.php"; $query = "SELECT id, employer, salary, salary_end \n FROM jobs \n WHERE closed = 'N'"; $mysqli = Database::connect(); $jobs = $mysqli->query($query); foreach ($jobs as $job) { $salary_end = $job['salary_end']; if ($salary_end <= 0 || is_null($salary_end)) { $salary_end = $job['salary']; } elseif ($salary_end < $job['salary']) { $salary_end = $job['salary']; } $data = array(); $data['potential_reward'] = Job::calculate_potential_reward_from($salary_end, $job['employer']); $a_job = new Job($job['id']); if ($a_job->update($data)) { echo "Updated job " . $job['id'] . "\n"; } else { echo "Not updated job " . $job['id'] . "\n"; } }