function update_referal_signup($user_id) { try { if ($user_id != '-') { $user = User::find($user_id); if (isset($user->id)) { $month = date('m'); $year = date('Y'); $referral = Referral::where('user_id', '=', $user_id)->where(DB::raw('month(created_at)'), '=', $month)->where(DB::raw('year(created_at)'), '=', $year)->first(); if (!isset($referral->id)) { $referral = new Referral(); $referral->user_id = $user_id; } $referral->total_signup = $referral->total_signup + 1; if ($referral->proposal_gained <= 30) { $proposal = 5; $referral->proposal_gained = $referral->proposal_gained + $proposal; $account = Account::where('user_id', '=', $user_id)->first(); $account->monthly_proposal_limit = $account->monthly_proposal_limit + $proposal; $account->save(); } $referral->save(); } } } catch (Exception $e) { } }
private function get_referred_jobs() { $criteria = array('columns' => "industries.industry, jobs.id, jobs.title, COUNT(referrals.id) AS num_referrals, \n DATE_FORMAT(jobs.expire_on, '%e %b, %Y') AS formatted_expire_on, \n jobs.description", 'joins' => 'jobs ON jobs.id = referrals.job, industries ON industries.id = jobs.industry', 'match' => "jobs.employer = '" . $this->employer->getId() . "' AND \n need_approval = 'N' AND \n (referrals.referee_acknowledged_on IS NOT NULL AND referrals.referee_acknowledged_on <> '0000-00-00 00:00:00') AND \n (referrals.member_confirmed_on IS NOT NULL AND referrals.member_confirmed_on <> '0000-00-00 00:00:00') AND \n referrals.employer_removed_on IS NULL AND \n (referrals.replacement_authorized_on IS NULL OR referrals.replacement_authorized_on = '0000-00-00 00:00:00')", 'group' => 'referrals.job', 'order' => 'num_referrals DESC'); $referral = new Referral(); $result = $referral->find($criteria); if ($result === false || is_null($result) || empty($result)) { return false; } foreach ($result as $i => $row) { $result[$i]['description'] = htmlspecialchars_decode(desanitize($row['description'])); $result[$i]['new_referrals_count'] = '0'; } $criteria = array('columns' => 'jobs.id, COUNT(referrals.id) AS num_new_referrals', 'joins' => 'jobs ON jobs.id = referrals.job, resumes ON resumes.id = referrals.resume', 'match' => "jobs.employer = '" . $this->employer->getId() . "' AND \n (resumes.deleted = 'N' AND resumes.private = 'N') AND \n (referrals.employer_agreed_terms_on IS NULL OR referrals.employer_agreed_terms_on = '0000-00-00 00:00:00') AND \n (referrals.referee_acknowledged_on IS NOT NULL AND referrals.referee_acknowledged_on <> '0000-00-00 00:00:00') AND \n (referrals.member_confirmed_on IS NOT NULL AND referrals.member_confirmed_on <> '0000-00-00 00:00:00') AND \n (referrals.employed_on IS NULL OR referrals.employed_on = '0000-00-00 00:00:00') AND \n referrals.employer_removed_on IS NULL AND \n (referrals.replacement_authorized_on IS NULL OR referrals.replacement_authorized_on = '0000-00-00 00:00:00')", 'group' => 'referrals.job'); $new_referrals = $referral->find($criteria); if ($new_referrals === false) { return false; } foreach ($new_referrals as $new_referral) { foreach ($result as $i => $row) { if ($row['id'] == $new_referral['id']) { $result[$i]['new_referrals_count'] = $new_referral['num_new_referrals']; break; } } } return $result; }
function index() { if ($this->input->post('emails')) { $this->load->library('validation'); $rules['emails'] = 'valid_emails|required'; $fields['emails'] = 'referree emails'; $this->validation->set_fields($fields); $this->validation->set_rules($rules); $this->validation->set_message('valid_emails', 'All email addresses entered into %s must be valid, seperated by commas'); if ($this->validation->run() === TRUE) { $emails = explode(',', $this->input->post('emails')); $this->load->model('referral'); foreach ($emails as $email) { $referral = new Referral(); $referral->set('user', $this->_getUser()); $referral->set('referee', trim($email)); $referral->set('ipRequested', @$_SERVER['REMOTE_ADDR']); if ($referral->create()) { $viewData['checkpoints'][] = "You have successfully sent a referral email to {$email}."; } else { $viewData['errors'][] = "A referral email has already been sent to {$email}."; } } } } if ($this->validation->error_string) { $viewData['errors'][] = $this->validation->error_string; } $viewData['token'] = $this->_token(); $this->load->library('templatedata'); $templateData = new TemplateData(); $templateData->setHead('Refer a friend and get cash back'); $templateData->setView($viewData); $this->_template('user/referral', $templateData); }
public function savecontractor() { $refer_id = $_POST['refer_id']; $cont = new Contractors(); $cont->Name = $_POST['company_name']; $cont->ContactName = $_POST['your_name']; $cont->Phone = $_POST['company_phone']; $cont->Fax = $_POST['company_fax']; $cont->Address1 = $_POST['company_address']; $cont->City = $_POST['city']; $cont->State = $_POST['state']; $cont->Zip = $_POST['zip_code']; $cont->Email = $_POST['email']; $cont->Username = $_POST['username']; $cont->Password = $_POST['password']; $cont->Website = $_POST['website']; $cont->AboutBusiness = $_POST['about_business']; $cont->ProjectTypeId = $_POST['projecttype']; $cont->Services = $_POST['primary_services']; $cont->insert(); Yii::app()->Ini->savetovnoc($_POST['email']); $identity = new UserIdentity($_POST['email'], $_POST['password'], 'contractor'); //$identity=new UserIdentity('*****@*****.**','school30','contractors'); if ($identity->authenticate()) { Yii::app()->user->login($identity); $owner_id = Yii::app()->user->getId(); Yii::app()->Ini->savetoaffiliate($owner_id, 'contractor'); Yii::app()->Ini->savetocampaign($_POST['email'], $_POST['company_name']); if ($refer_id != '') { $rcont = Contractors::model()->findByPk($refer_id); if (count($rcont) > 0) { $t = ContractorTeam::model()->findByAttributes(array('contractor_id' => $rcont->ContractorId, 'invited_id' => $owner_id)); if (count($t) == 0) { $team = new ContractorTeam(); $team->contractor_id = $rcont->ContractorId; $team->invited_id = $owner_id; $team->confirmed = 1; $team->save(); $team2 = new ContractorTeam(); $team2->contractor_id = $owner_id; $team2->invited_id = $rcont->ContractorId; $team2->confirmed = 1; $team2->save(); } } $ref = new Referral(); $ref->userid = $owner_id; $ref->user_type = 'contractor'; $ref->referred_by = $refer_id; $ref->referred_by_type = 'contractor'; $ref->save(); } $status = array('status' => true); } else { $status = false; $status = array('status' => false, 'error_message' => $identity->errorMessage); } $this->renderJSON($status); }
function get_rewards($_is_paid = false, $_order_by) { $criteria = array('columns' => "invoices.id AS invoice, referrals.id AS referral, referrals.total_reward,\n referrals.job AS job_id, currencies.symbol AS currency, jobs.title, \n referrals.member AS member_id, referrals.employed_on, \n employers.name AS employer, members.phone_num, \n CONCAT(members.lastname, ', ', members.firstname) AS member, \n DATE_FORMAT(referrals.employed_on, '%e %b, %Y') AS formatted_employed_on, \n (SUM(referral_rewards.reward) / 3) AS paid_reward", 'joins' => "invoice_items ON invoice_items.item = referrals.id, \n invoices ON invoices.id = invoice_items.invoice, \n referral_rewards ON referral_rewards.referral = referrals.id, \n jobs ON jobs.id = referrals.job, \n members ON members.email_addr = referrals.member, \n employers ON employers.id = jobs.employer, \n currencies ON currencies.country_code = employers.country", 'match' => "invoices.type = 'R' AND \n (invoices.paid_on IS NOT NULL AND invoices.paid_on <> '0000-00-00 00:00:00') AND \n (referrals.employed_on IS NOT NULL AND referrals.employed_on <> '0000-00-00 00:00:00') AND \n (referrals.employer_removed_on IS NULL OR referrals.employer_removed_on = '0000-00-00 00:00:00') AND \n (referrals.referee_rejected_on IS NULL OR referrals.referee_rejected_on = '0000-00-00 00:00:00') AND \n (referrals.replacement_authorized_on IS NULL OR referrals.replacement_authorized_on = '0000-00-00 00:00:00') AND \n (referrals.guarantee_expire_on <= CURDATE() OR referrals.guarantee_expire_on IS NULL) ", 'group' => "referrals.id", 'order' => $_order_by, 'having' => "(paid_reward < referrals.total_reward OR paid_reward IS NULL)"); if ($_is_paid) { $criteria['columns'] .= ", referral_rewards.gift, DATE_FORMAT(MAX(referral_rewards.paid_on), '%e %b, %Y') AS formatted_paid_on"; $criteria['having'] = "(paid_reward >= referrals.total_reward OR referral_rewards.gift IS NOT NULL)"; } else { $criteria['match'] .= "AND (referral_rewards.gift IS NULL OR referral_rewards.gift = '')"; } $referral = new Referral(); return $referral->find($criteria); }
public function testIsReferred() { //Insert into referral table $referral = new Referral(); $referral->status = Referral::REFERRED_IN; $referral->facility_id = 1; $referral->person = "Gentrix"; $referral->contacts = "Saville Row : London"; $referral->user_id = 1; $specimen = Specimen::find(1); $referral->save(); $specimen->referral_id = $referral->id; $specimen->save(); $this->assertEquals($specimen->isReferred(), true); }
/** * Internal function to return a Referral object from a row. * @param $row array * @return Referral */ function &_returnReferralFromRow(&$row) { $referral = new Referral(); $referral->setId($row['referral_id']); $referral->setArticleId($row['article_id']); $referral->setStatus($row['status']); $referral->setUrl($row['url']); $referral->setDateAdded($this->datetimeFromDB($row['date_added'])); $referral->setLinkCount($row['link_count']); $this->getDataObjectSettings('referral_settings', 'referral_id', $row['referral_id'], $referral); return $referral; }
/** * Return the open referral choices for the patient. * * @return Referral[] */ public function getReferralChoices($element = null) { $criteria = new CdbCriteria(); $criteria->addCondition('patient_id = :pid'); $criteria->addCondition('closed_date is null'); $criteria->params = array('pid' => $this->patient->id); // if the referral has been closed but is the selected referral for the event, needs to be part of the list if ($element && $element->referral_id) { $criteria->addCondition('id = :crid', 'OR'); $criteria->params[':crid'] = $element->referral_id; } $criteria->order = 'received_date DESC'; return Referral::model()->findAll($criteria); }
/** * Export the referrals and the related newcomers into a CSV file. * * @return string */ public function getExportReferrals() { $referrals = Student::select([\DB::raw('students.first_name'), \DB::raw('students.last_name')])->orderBy('last_name')->rightjoin('newcomers as n', 'students.student_id', '=', 'n.referral_id')->addSelect([\DB::raw('n.branch as branch'), \DB::raw('n.first_name as newcomer_first_name'), \DB::raw('n.last_name as newcomer_last_name'), \DB::raw('n.phone as newcomer_phone')])->get(); return Excel::create('Referrals', function ($file) use($referrals) { $file->sheet('', function ($sheet) use($referrals) { $sheet->fromArray($referrals); }); })->export('csv'); $referrals = Referral::orderBy('last_name')->where('validated', 1)->get(); // Embed the referral's newcomers in the document. foreach ($referrals as &$referral) { for ($i = 0; $i < $referral->newcomers()->count(); $i++) { $newcomer = $referral->newcomers()->get()->toArray()[$i]; $referral['Fillot ' . $i] = $newcomer['first_name'] . ' ' . $newcomer['last_name']; } } return Excel::create('Parrains', function ($file) use($referrals) { $file->sheet('', function ($sheet) use($referrals) { $sheet->fromArray($referrals); }); })->export('csv'); }
public function CommOrdi() { $cat = Category::model()->findByAttributes(array('cat_name' => 'Provincial Ordinance'))->cat_id; $result = CHtml::listData(Communication::model()->findAll(array('condition' => 'cat_id = ' . $cat . ' and comm_stat=1')), 'ctrl_no', 'ctrl_no'); $criteria = new CDbCriteria(); $criteria->condition = "referral_stat=0"; $criteria->addInCondition("ctrl_no", $result); $criteria2 = new CDbCriteria(); $criteria2->addInCondition("ctrl_no", $result); return $this->isNewRecord ? CHtml::listData(Referral::model()->findAll($criteria), 'ref_id', 'ctrl_no') : CHtml::listData(Referral::model()->findAll($criteria2), 'ref_id', 'ctrl_no'); }
?> <br> <div class="span8"> <div class="wide form"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get')); CHtml::$afterRequiredLabel = ''; ?> <?php echo $form->dropDownListRow($model, 'meeting_ordi_id', CHtml::listData(CommMeetingOrdi::model()->findAll(), 'meeting_ordi_id', 'meeting_ordi_id'), array('class' => 'span3', 'prompt' => 'Committee Meeting ID')); ?> <?php echo $form->dropDownListRow($model, 'ref_id', CHtml::listData(Referral::model()->findAll(), 'ref_id', 'ctrl_no'), array('class' => 'span3', 'prompt' => 'Control Number')); ?> <?php echo $form->dropDownListRow($model, 'action_taken', array(0 => 'Pending', 1 => 'Approved', 2 => 'Return to Origin'), array('class' => 'span3', 'prompt' => 'Action Taken')); ?> <?php echo $form->datepickerRow($model, 'date_meeting', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?> <?php echo $form->datepickerRow($model, 'public_hearing', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?>
/** * Save referral. */ function execute() { $referralDao =& DAORegistry::getDAO('ReferralDAO'); if (isset($this->referralId)) { $referral =& $referralDao->getReferral($this->referralId); } if (!isset($referral)) { $referral = new Referral(); $referral->setDateAdded(Core::getCurrentDate()); $referral->setLinkCount(0); } $referral->setArticleId($this->article->getId()); $referral->setName($this->getData('name'), null); // Localized $referral->setUrl($this->getData('url')); $referral->setStatus($this->getData('status')); // Update or insert referral if ($referral->getId() != null) { $referralDao->updateReferral($referral); } else { $referralDao->insertReferral($referral); } }
<?php require Yii::getPathOfAlias('webroot') . '/protected/extensions/tcpdf/' . 'tcpdf.php'; // Data loading $pdf = new TCPDF('L', PDF_UNIT, 'Legal', true, 'UTF-8', false); // set document information $referralduedateCount = count(Referral::model()->findAll(array('condition' => 'referral_stat = 0 and now() > duedate'))); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(User::model()->findByPK(Yii::app()->user->name)->emp->Fullname); $pdf->SetTitle($referralduedateCount . ' Pending Referrals - Referrals without Committee Reports as of today'); // set default header data $pdf->SetHeaderData('banner.jpg', PDF_HEADER_LOGO_WIDTH, 'Legislative Information System - Provincial Government of La Union v1.0'); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); //$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(15, $pdf->GetY() + 55, 15); $pdf->SetHeaderMargin(10); $pdf->SetFooterMargin(30); $pdf->SetAutoPageBreak(true, 65); // set auto page breaks //$pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); }
public function getReferralDate($ctrl) { if ($ctrl) { $x = CommMeetingOrdi::model()->findByAttributes(array('meeting_ordi_id' => $ctrl))->ref_id; return Referral::model()->findByPK($x)->date_referred; } else { return 'No Referral Date'; } }
public function actionCommReportYearly() { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Searched Yearly Committe Report per Committe'; $activity->act_datetime = date('Y-m-d G:i:s'); $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; $activity->save(); $comm_name = ''; $ref_id = ''; $year = date('Y'); if (isset($_POST['searchButton'])) { $comm_name = $_POST['comm_name']; $year = $_POST['year']; $x = Committee::model()->findByPK($comm_name); $referrals = CHtml::listData(Referral::model()->findAll(array('condition' => 'lead_committee = :lcomm', 'params' => array(':lcomm' => $x->comm_id))), 'ref_id', 'ref_id'); $criteria = new CDbCriteria(); $criteria->condition = "action_taken <> 0 and comm_report like :comm_rep"; $criteria->params = array(':comm_rep' => $year . '%'); $criteria->addInCondition("ref_id", $referrals); $criteria->order = 'comm_report asc'; $dataProviderReso = new CActiveDataProvider('CommMeetingReso', array('criteria' => $criteria, 'pagination' => array('pageSize' => 20))); $dataProviderOrd = new CActiveDataProvider('CommMeetingOrdi', array('criteria' => $criteria, 'pagination' => array('pageSize' => 20))); date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Searched Yearly Committe Report of ' . $x->comm_name; $activity->act_datetime = date('Y-m-d G:i:s'); $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; $activity->save(); } else { $dataProviderReso = new CActiveDataProvider('CommMeetingReso', array('criteria' => array('condition' => 'action_taken <> 0 or comm_report = null'), 'pagination' => array('pageSize' => 20))); $dataProviderOrd = new CActiveDataProvider('CommMeetingOrdi', array('criteria' => array('condition' => 'action_taken <> 0 or comm_report = null'), 'pagination' => array('pageSize' => 20))); } $this->render('commReportYearly', array('comm_name' => $comm_name, 'year' => $year, 'dataProviderReso' => $dataProviderReso, 'dataProviderOrd' => $dataProviderOrd)); }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['CommMeetingReso'])) { $model->attributes = $_POST['CommMeetingReso']; $model->archive = 0; $ref_id = Referral::model()->findByAttributes(array('ctrl_no' => $model->ref_id))->ref_id; $model->ref_id = $ref_id; $model->remark = 0; if ($model->action_taken != 0) { //Status::model()->updateAll(array('referral_stat' => 1), 'ctrl_no = ' . $model->ref->ctrl_no); Referral::model()->updateByPK($model->ref_id, array('referral_stat' => 1)); $stat = Status::model()->findByAttributes(array('ctrl_no' => $model->ref->ctrl_no)); $stat->ctrl_no = $model->ref->ctrl_no; $stat->comm_meeting_stat = 1; $stat->remarks = 0; $stat->save(); //die('approve'); } else { $stat = Status::model()->findByAttributes(array('ctrl_no' => $model->ref->ctrl_no)); $stat->ctrl_no = $model->ref->ctrl_no; $stat->comm_meeting_stat = 0; $stat->remarks = 0; $stat->save(); //die('pending'); } $picture_name = ''; $picture_file = CUploadedFile::getInstance($model, 'comm_rep_file'); $model->comm_rep_file = $picture_file; $year = substr($model->ref->ctrl_no, 0, 4); if ($picture_file) { $picture_name = $picture_file->name; if (!is_dir(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year)) { mkdir(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year); mkdir(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year . '/' . $model->ref->ctrl_no); $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year . '/' . $model->ref->ctrl_no . '/' . $picture_file->getName()); } else { if (!file_exists(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year . '/' . $model->ref->ctrl_no)) { //die('exists'); //mkdir(Yii::getPathOfAlias('webroot').'/protected/document/commMeetingReso/'.$year.'/'.$model->ref->ctrl_no); $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year . '/' . $model->ref->ctrl_no . '/' . $picture_file->getName()); } else { //mkdir(Yii::getPathOfAlias('webroot').'/protected/document/commMeetingReso/'.$year.'/'.$model->ref->ctrl_no); $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year . '/' . $model->ref->ctrl_no . '/' . $picture_file->getName()); } } } if ($model->save() && $model->validate()) { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Updated Committee Meeting ID: ' . $id; $activity->act_datetime = date('Y-m-d G:i:s'); $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; $activity->save(); $this->redirect(array('view', 'id' => $model->meeting_reso_id)); } } $this->render('update', array('model' => $model)); }
$data['resume'] = $resume; $data['referred_on'] = $timestamp; $data['referee_acknowledged_on'] = $timestamp; $data['member_confirmed_on'] = $timestamp; $data['member_read_resume_on'] = $timestamp; $data['job'] = 0; foreach ($job_ids as $job) { $data['job'] = $job; if ($referral->create($data) === false) { $criteria = array("columns" => "id", "match" => "member = '" . $member . "' AND \n referee = '" . $referee . "' AND \n job = " . $job, "limit" => "1"); $result = $referral->find($criteria); if (is_null($result) || count($result) <= 0 || $result === false) { $failed_jobs[] = $job; continue; } $existing_referral = new Referral($result[0]['id']); if ($existing_referral->update($data) === false) { $failed_jobs[] = $job; } } } if (!empty($failed_jobs) && count($failed_jobs) > 0) { $criteria = array("columns" => "jobs.id, jobs.title, employers.id, employers.name AS employer, \n jobs.expire_on", "joins" => "employers ON employers.id = jobs.employer", "match" => "jobs.id IN (" . implode(',', $failed_jobs) . ")"); $job = new Job(); $result = $job->find($criteria); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array(array('failed_jobs' => array('job' => $result))); exit; } // put new non-applied jobs into member_jobs too // 1. get the job IDs not in member_jobs
public function actionCreate($id) { $model = new Resolution(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $count = count(Resolution::model()->findAll(array('condition' => 'res_no like "%' . date('Y') . '"'))) + 1; if ($count <= 99) { if ($count <= 9) { $count = '00' . $count . ' - ' . date('Y'); } else { $count = '0' . $count . ' - ' . date('Y'); } } else { $count = $count . ' - ' . date('Y'); } if (isset($_POST['Resolution'])) { $model->attributes = $_POST['Resolution']; $model->archive = 0; $picture_name = ''; $picture_file = CUploadedFile::getInstance($model, 'reso_file'); $model->reso_file = $picture_file; if ($picture_file) { $picture_name = $picture_file->name; if (!is_dir(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4))) { mkdir(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4)); } if (!is_dir(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4) . '/' . $model->res_no)) { mkdir(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4) . '/' . $model->res_no); $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4) . '/' . $model->res_no . '/' . $picture_file->getName()); } else { $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4) . '/' . $model->res_no . '/' . $picture_file->getName()); } } $model->author = implode(',', $model->author); $model->input_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; //------------------------------------------------- $stat = Status::model()->findByAttributes(array('ctrl_no' => $model->ctrl_no)); $stat->remarks = 1; $stat->save(); if (!empty(Referral::model()->findByAttributes(array('ctrl_no' => $model->ctrl_no))->ref_id)) { $temp = Referral::model()->findByAttributes(array('ctrl_no' => $model->ctrl_no))->ref_id; $meeting = CommMeetingReso::model()->find(array('condition' => 'ref_id = ' . $temp . ' and action_taken=1 or action_taken=2')); $meeting->comm_meeting_stat = 1; $meeting->remark = 1; $meeting->save(); } if ($model->save()) { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Added Another Resolution'; $activity->act_datetime = date('Y-m-d G:i:s'); $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; $activity->save(); $this->redirect(array('view', 'id' => $model->res_no)); } } $this->render('create', array('model' => $model, 'count' => $count, 'id' => $id)); }
public function getCommMeetings($d) { $temp = Referral::model()->findByAttributes(array('ctrl_no' => $d)); if (empty($temp)) { echo 'No Committee Meeting'; } else { $x = CommMeetingReso::model()->find(array('condition' => 'ref_id = "' . $temp->ref_id . '"')); if ($x == null) { echo '0000-00-00'; } else { $IAs = CommMeetingReso::model()->findAll(array('condition' => 'ref_id = "' . $temp->ref_id . '"', 'order' => 'date_meeting desc')); $iaName = CHtml::listData($IAs, 'date_meeting', 'date_meeting'); foreach ($iaName as $val) { echo $val . '<br/>'; } } } }
</div><!-- header --> <div class="container" id="page" > <?php $countNotif = count(ForumQuestion::model()->findAll(array('condition' => 'confirmation=0'))); $notif = $this->widget('bootstrap.widgets.TbBadge', array('type' => $countNotif == 0 ? 'info' : 'important', 'label' => $countNotif), true); $receiving = count(Communication::model()->findAll(array('condition' => 'type_comm = 2 and now() >= date_agenda '))); $notifRC = $this->widget('bootstrap.widgets.TbBadge', array('type' => $receiving == 0 ? 'info' : 'important', 'label' => $receiving), true); $referralCount = count(Communication::model()->findAll(array('condition' => 'archive=0 and comm_stat=0 and type_comm<>2'))); $referralduedateCount = count(Referral::model()->findAll(array('condition' => 'referral_stat = 0 and now() > duedate'))); $meetingResoCount = count(Referral::model()->countCommMeetingReso()); $meetingOrdiCount = count(Referral::model()->countCommMeetingOrdi()); $rfTotal = 0; $rfTotal = $referralCount + $meetingOrdiCount + $meetingResoCount + $referralduedateCount; $notifRFTotal = $this->widget('bootstrap.widgets.TbBadge', array('type' => $rfTotal == 0 ? 'info' : 'important', 'label' => $rfTotal), true); $notifRFrefduedate = $this->widget('bootstrap.widgets.TbBadge', array('type' => $referralduedateCount == 0 ? 'info' : 'important', 'label' => $referralduedateCount), true); $notifRFref = $this->widget('bootstrap.widgets.TbBadge', array('type' => $referralCount == 0 ? 'info' : 'important', 'label' => $referralCount), true); $notifRFreso = $this->widget('bootstrap.widgets.TbBadge', array('type' => $meetingResoCount == 0 ? 'info' : 'important', 'label' => $meetingResoCount), true); $notifRFordi = $this->widget('bootstrap.widgets.TbBadge', array('type' => $meetingOrdiCount == 0 ? 'info' : 'important', 'label' => $meetingOrdiCount), true); $resoCount = count(Status::model()->countResolution()); $ordiCount = count(CommMeetingOrdi::model()->findAll(array('condition' => 'archive=0 and comm_meeting_stat=1 and ord_remark=0 and action_taken=1'))); $tTotal = 0; $tTotal = $resoCount + $ordiCount; $notifTtotal = $this->widget('bootstrap.widgets.TbBadge', array('type' => $tTotal == 0 ? 'info' : 'important', 'label' => $tTotal), true); $notifTreso = $this->widget('bootstrap.widgets.TbBadge', array('type' => $resoCount == 0 ? 'info' : 'important', 'label' => $resoCount), true); $notifTordi = $this->widget('bootstrap.widgets.TbBadge', array('type' => $ordiCount == 0 ? 'info' : 'important', 'label' => $ordiCount), true); $role = Yii::app()->user->getState("roles");
<td style="border-top-style: 1px solid black;">' . $origin . '</td>'; $tbl .= '</tr>'; if ($referral == '0000-00-00') { $tbl .= '<tr nobr="true"> <td style="border-top-style: 1px solid black; font-size:16px; font-weight:bold;">C) Referral Date</td> <td style="border-top-style: 1px solid black;">: N/A</td>'; } else { $tbl .= '<tr nobr="true"> <td style="border-top-style: 1px solid black; font-size:16px; font-weight:bold;">C) Referral Date</td> <td style="border-top-style: 1px solid black;">' . $refer1->format('M j, Y') . '</td>'; } $tbl .= '</tr>'; $tbl .= '<tr nobr="true"> <td style="border-top-style: 1px solid black; font-size:15px; font-weight:bold;">D) Date Meeting/s</td>'; $meetings = ''; $temp = Referral::model()->findByAttributes(array('ctrl_no' => $model->ctrl_no)); if (empty($temp)) { $meetings = '0000-00-00'; } else { $x = CommMeetingReso::model()->find(array('condition' => 'ref_id = "' . $temp->ref_id . '"')); if ($x == null) { $meetings = '0000-00-00'; } else { $IAs = CommMeetingReso::model()->findAll(array('condition' => 'ref_id = "' . $temp->ref_id . '"', 'order' => 'date_meeting desc')); $iaName = CHtml::listData($IAs, 'date_meeting', 'date_meeting'); foreach ($iaName as $val) { $meetings = $val . '' . $meetings; } } } $meetings1 = new DateTime($meetings, $timezone);
public function countCommMeetingOrdi() { $cat = Category::model()->findByAttributes(array('cat_name' => 'Provincial Ordinance'))->cat_id; $result = CHtml::listData(Communication::model()->findAll(array('condition' => 'cat_id = ' . $cat . ' and comm_stat=1')), 'ctrl_no', 'ctrl_no'); $criteria = new CDbCriteria(); $criteria->condition = 'archive=0 and referral_stat=0'; $criteria->addInCondition("ctrl_no", $result); $criteria->compare('ctrl_no', $this->ctrl_no, true); return Referral::model()->findAll($criteria); }
$available_branches = array(); foreach ($result as $row) { $available_branches[] = $row['country']; } $team = '*****@*****.**'; if (in_array($member->get_country_code(), $available_branches)) { $team = 'team.' . strtolower($member->get_country_code()) . '@yellowelevator.com'; } $message = 'IRC testimony alert. Please login to Employees account to check.'; $subject = 'IRC Testimony Alert'; $headers = 'From: YellowElevator.com <*****@*****.**>' . "\n"; mail($team, $subject, $message, $headers); } } echo $return; exit; } if ($_POST['action'] == 'has_banks') { $member = new Member($_POST['id'], $_SESSION['yel']['member']['sid']); $banks = $member->get_banks(); if (is_null($banks) || count($banks) <= 0) { echo '0'; exit; } echo '1'; exit; } if ($_POST['action'] == 'referred_already') { echo !Referral::already_referred($_POST['id'], $_POST['candidate'], $_POST['job']) ? '0' : '1'; exit; }
if ($current_app['job_id'] == $result[$j]['job_id']) { if ($current_app['tab'] == 'ref') { $skips[] = $j; } else { $skips[] = $i; } } } } } if (!in_array($i, $skips)) { $filter_apps[] = $current_app; } } $result = $filter_apps; $response = array('applications' => array('application' => $result)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'confirm_employment') { $referral = new Referral($_POST['id']); $data = array(); $data['referee_confirmed_hired_on'] = now(); if ($referral->update($data) === false) { echo 'ko'; exit; } echo 'ok'; exit; }
function logArticleRequest(&$templateMgr) { $article = $templateMgr->get_template_vars('article'); if (!$article) { return false; } $articleId = $article->getId(); $referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; // Check if referrer is empty or is the local journal if (empty($referrer) || strpos($referrer, Request::getIndexUrl()) !== false) { return false; } $referralDao =& DAORegistry::getDAO('ReferralDAO'); if ($referralDao->referralExistsByUrl($articleId, $referrer)) { // It exists -- increment the count $referralDao->incrementReferralCount($article->getId(), $referrer); } else { // It's a new referral -- log it. $referral = new Referral(); $referral->setArticleId($article->getId()); $referral->setLinkCount(1); $referral->setUrl($referrer); $referral->setStatus(REFERRAL_STATUS_NEW); $referral->setDateAdded(Core::getCurrentDate()); $referralDao->insertReferral($referral); } }
$r->save(); return View::make('recurly.confirm')->with('response', $response); }); Route::post('recurly-notification', array('before' => 'postnotification', function () { $o = Option::find('1'); //need to handle $post_xml = file_get_contents("php://input"); $notification = new Recurly_PushNotification($post_xml); $raw = new RawNotification(); $raw->type = $notification->type; $raw->xml = $post_xml; $raw->save(); if ($notification->type == 'successful_payment_notification') { //check if need to have sent commission event if ($notification->transaction->subscription_id != '' && $notification->transaction->subscription_id != null) { $r = Referral::where('uuid', '=', $notification->transaction->subscription_id)->first(); if ($r == null) { //save to process later $n = new Notification(); $n->uuid = $notification->transaction->subscription_id; $n->revenue = $notification->transaction->amount_in_cents; $n->save(); } else { /*$rev = $notification->transaction->amount_in_cents / 100.00; $campaign_id = ''; $username = ''; $api_key = ''; $api_url = "https://getambassador.com/api/v2/$username/$api_key/xml/event/record"; $data = array( 'email' => $r->email, 'campaign_uid' => $campaign_id,
/** * Intercept requests for article display to collect and record * incoming referrals. */ function logArticleRequest(&$templateMgr) { $article = $templateMgr->get_template_vars('article'); if (!$article) { return false; } $articleId = $article->getId(); $referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; // Check if referrer is empty or is the local journal if (empty($referrer) || strpos($referrer, Request::getIndexUrl()) !== false) { return false; } $referralDao =& DAORegistry::getDAO('ReferralDAO'); if ($referralDao->referralExistsByUrl($articleId, $referrer)) { // It exists -- increment the count $referralDao->incrementReferralCount($article->getId(), $referrer); } else { // It's a new referral. Log it unless it's excluded. $journal = $templateMgr->get_template_vars('currentJournal'); $exclusions = $this->getSetting($journal->getId(), 'exclusions'); foreach (array_map('trim', explode("\n", "{$exclusions}")) as $exclusion) { if (empty($exclusion)) { continue; } if (preg_match($exclusion, $referrer)) { return false; } } $referral = new Referral(); $referral->setArticleId($article->getId()); $referral->setLinkCount(1); $referral->setUrl($referrer); $referral->setStatus(REFERRAL_STATUS_NEW); $referral->setDateAdded(Core::getCurrentDate()); $referralDao->insertReferral($referral); } return false; }
} } header('Content-type: text/xml'); $response = array('found_employers' => array('found_employer' => $found_employers), 'pagination' => array('total_pages' => $total_pages, 'current_page' => $_POST['page']), 'application' => $result); echo $xml_dom->get_xml_from_array(array('applications' => $response)); exit; } if ($_POST['action'] == 'get_testimony') { $criteria = array('columns' => "testimony", 'match' => "id = " . $_POST['id'], 'limit' => "1"); $referral = new Referral(); $result = $referral->find($criteria); $testimony = htmlspecialchars_decode(str_replace("\n", '<br/>', $result[0]['testimony'])); echo $testimony; exit; } if ($_POST['action'] == 'get_job_desc') { $criteria = array('columns' => "description", 'match' => "id = " . $_POST['id'], 'limit' => "1"); $job = new Job(); $result = $job->find($criteria); $job_desc = htmlspecialchars_decode(str_replace("\n", '<br/>', $result[0]['description'])); echo $job_desc; exit; } if ($_POST['action'] == 'get_employer_remarks') { $criteria = array('columns' => "employer_remarks", 'match' => "id = " . $_POST['id'], 'limit' => "1"); $referral = new Referral(); $result = $referral->find($criteria); $remarks = str_replace("\n", '<br/>', stripslashes($result[0]['employer_remarks'])); echo $remarks; exit; }
$mysqli->transact($query); ?> <script type="text/javascript">top.stop_quick_refer_upload('-6');</script><?php exit; } // 2. create referral with pre-approvals from the referrer's side $data = array(); $data['member'] = $member->id(); $data['job'] = $_POST['qr_job_id']; $data['referred_on'] = $today; $data['referee'] = $candidate_email; $data['member_confirmed_on'] = $today; $data['member_read_resume_on'] = $today; $data['testimony'] = $testimony; $data['resume'] = $resume->id(); if (!Referral::create($data)) { ?> <script type="text/javascript">top.stop_quick_refer_upload('-7');</script><?php exit; } $lines = file(dirname(__FILE__) . '/private/mail/member_referred.txt'); if (!$is_friend) { $lines = file(dirname(__FILE__) . '/private/mail/member_referred_approval.txt'); } $message = ''; foreach ($lines as $line) { $message .= $line; } $position = '- ' . htmlspecialchars_decode($job) . ' at ' . htmlspecialchars_decode($employer); $message = str_replace('%member_name%', htmlspecialchars_decode($member->get_name()), $message); $message = str_replace('%member_email_addr%', $member->id(), $message);
exit; } foreach ($result as $i => $row) { $result[$i]['padded_invoice'] = pad($row['invoice'], 11, '0'); } $response = array('replacements' => array('replacement' => $result)); header('Content-type: text/xml'); echo $xml_dom->get_xml_from_array($response); exit; } if ($_POST['action'] == 'authorize_replacement') { $today = now(); $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; }