/** * Overriding doSave method from lib/vendor/symfony/lib/form/addon/sfFormObject.class.php * * We are updating the data base in just 1 transaction * In case of unsetting longitude or latitude fields you will have to override this method. * TODO: create a Doctrine_Record for PostGIS */ protected function doSave($con = null) { if (null === $con) { $con = $this->getConnection(); } if (!$this->getObject()->isNew()) { $office = OfficeTable::getInstance()->findOneById($this->getObject()->getId()); } else { $office = new Office(); $office->company_id = $this->getObject()->getCompanyId(); } $office->city_id = $this->values['city_id']; $office->office_street_address = $this->values['office_street_address']; $office->office_zip = $this->values['office_zip']; //TODO: Symfony sucks $this->object = $office; $office->save(); //Get latitude and longitude values. They will be translated to GEOGRAPHIC data. foreach ($this->values as $field => $value) { if ($field == 'longitude') { $longitude = $value; } if ($field == 'latitude') { $latitude = $value; } } //Catch id element. We will use this id to insert the PostGIS value in the right row. $rowId = $office->getId(); //Update PostGIS //This connection will throw exception in case of error. Doctrine_Manager::connection()->execute("UPDATE office SET office_gps=ST_GeographyFromText('SRID=4326;POINT({$longitude} {$latitude})') WHERE id={$rowId}"); }
public function edit(Office $model) { $this->backLink = $this->createUrl('index'); if (isset($_POST['Office'])) { $model->attributes = $_POST['Office']; $model->addressId = $_POST['Address']['id']; $model->setPostcodes($_POST['operatingPostcode']); if ($model->save()) { Yii::app()->user->setFlash('office-update-success', 'Office sucessfully updated'); $this->redirect(array('update', 'id' => $model->id)); } } $this->render('edit', array('model' => $model)); }
public function up() { $this->addColumn($this->tableName, $this->columnName, 'int'); /** @var $data Office[] */ $data = Office::model()->findAll(); $migratedAddresses = []; foreach ($data as $office) { $fullAddress = implode(' ', [$office->address1, $office->address2, $office->address3, $office->address4]); if (isset($migratedAddresses[$fullAddress])) { $office->addressId = $migratedAddresses[$fullAddress]->id; $office->save(false); continue; } $parts = explode(' ', $office->address1); $buildingNumber = array_shift($parts); $line2 = implode(' ', $parts); $address = new Address(); $address->line1 = $buildingNumber; $address->line2 = $line2; $address->line5 = $office->address3; $address->postcode = $office->postcode; $address->save(); $migratedAddresses[$fullAddress] = $address; $office->addressId = $migratedAddresses[$fullAddress]->id; $office->save(false); continue; } }
public function showIndex() { $page = $this->node; $tree = Collector::get('root'); $subTree = Tree::getSubTree($tree, $page); $blocks = null; if ($subTree) { foreach ($subTree->children as $node) { if ($node->slug != 'blocks') { continue; } $blocks = $node->children; break; } } foreach ($blocks as $index => $block) { $blocks[$block->slug] = $block; unset($blocks[$index]); } if (isset($blocks['reporting'])) { $blocks['reporting']->children = $blocks['reporting']->children->reverse(); } $news = News::active()->byCatalog(Collector::get('idNewsCatalog'))->byCategories(Collector::get('idInvestorRelationsCategory'))->desc()->get(); $offices = Office::with('city')->active()->legal()->get(); $officesMap = Office::getMap($offices); return View::make('investor.index', compact('page', 'blocks', 'news', 'officesMap')); }
private function fixManagement(Office $model) { $cam = Office::model()->findByAttributes(array('code' => 'CAM')); $model->email = '*****@*****.**'; $model->address = $cam->address; $model->addressId = $cam->addressId; }
static function signature($type = self::TYPE_HTML) { $officeData = Office::model()->active()->findAll(); if ($type == self::TYPE_HTML) { $emailMediaImageUrl = "http://" . Yii::app()->params['hostname'] . "/images/email/"; $emailMediaLinks = ' <div> <a href="https://www.woosterstock.co.uk/"><img src="' . $emailMediaImageUrl . 'Wooster-Logo-Orange.png" alt="Wooster&Stock"/></a> <a href="https://www.facebook.com/woosterstock"><img src="' . $emailMediaImageUrl . 'facebook_square_black.png" alt=""></a> <a href="https://twitter.com/woosterstock"><img src="' . $emailMediaImageUrl . 'ttwitter_square_black.png" alt=""></a> <a href="http://vimeo.com/user13981519""><img src="' . $emailMediaImageUrl . 'vimeo_square_black.png" alt=""></a> </div> '; $officeFooter = '<table class="valuation-email-footer" style="width: 600px; font-size: 12px; color: #555; font-family:Arial, Helvetica, sans-serif; "><tr>'; foreach ($officeData as $value) { $officeFooter .= '<td style="vertical-align:top"> <div>' . $value->shortTitle . '</div> <div><a href = "mailto:' . $value->email . '"> ' . $value->email . '</a></div> <div>Phone: ' . $value->phone . '</div> </td> '; } $officeFooter .= '</tr></table> '; return '<div style = "font-family:Arial, Helvetica, sans-serif; font-size:15px; font-weight: bold; color:#FF9900">' . $emailMediaLinks . '</div> ' . $officeFooter; } else { $officeFooter = ''; foreach ($officeData as $value) { $officeFooter .= "\n\t\t\t\t\t\t\t{$value->shortTitle}\n\n\t\t\t\t\t\t\t" . ($value->address ? $value->address->getFullAddressString() . "\n" : "") . "Phone: {$value->phone}\n\n"; } return 'Wooster & Stock woosterstock.co.uk ' . $officeFooter; } }
public function getOffices() { $offices = Office::all(); foreach ($offices as $office) { $office->rendered_html = $office->html(); } return $offices; }
public function buildOffice(AddressInfo $address_info) { $office = new Office(); list($address1, $address2) = $address_info->getAddress(); $office->setAddress($address1); $office->setAddress1($address2); $office->setZipCode($address_info->getZipCode()); $office->setCity($address_info->getCity()); $office->setState($address_info->getState()); $office->setCountry($address_info->getCountry()); return $office; }
public function run() { /** @var Office[] $o */ $o = Office::model()->active()->findAll(); $offices = []; foreach ($o as $office) { $offices[explode('@', $office->email)[0]] = $office->shortTitle; } /** @var $detector \Device */ $isMobile = Yii::app()->device->isDevice('mobile') ? true : false; $this->render($this->view ? $this->view : 'default', array('model' => $this->model, 'offices' => $offices, 'isMobile' => $isMobile)); }
/** * undocumented function * * @param string $officeId * @return void * @access public */ function admin_activate($officeId = null) { if ($officeId == Configure::read('Office.id')) { $msg = __('This office is already active.', true); return $this->Message->add($msg, 'ok'); } Assert::true(Office::isOwn($officeId), '403'); $office = $this->Office->find('first', array('conditions' => array('Office.id' => $officeId), 'contain' => array('SubOffice', 'ParentOffice'))); Assert::notEmpty($office, '404'); $this->Office->activate($office['Office']['id']); $msg = __('The office was successfully activated!', true); return $this->Message->add($msg, 'ok', true, Controller::referer()); }
public function execute() { if (empty($_POST['city'])) { throw new InvalidParamException(); } $result = Office::fromDatabaseSearchByCity($_POST['city']); $content = array(); $content['NumOffices'] = count($result); $content['Offices'] = array(); foreach ($result as $office) { $officeObj = array('Code' => $office->getCode(), 'Name' => $office->getName(), 'City' => $office->getCity(), 'Address' => $office->getAddress(), 'Host' => $office->getHost()); $content['Offices'][] = $officeObj; } return $content; }
public function deleteOffice($id) { $deleteoffice = Office::find($id); $usersInOffice = User::where('office_id', $id)->count(); if ($usersInOffice == 0) { $deleteoffice->delete(); $users = User::where('office_id', $id)->get(); foreach ($users as $user) { $user->office_id = 0; $user->save(); } return Redirect::to('/offices')->with('success', 'Successfully deleted'); } else { return Redirect::to('/offices')->with('invalid', 'Unable to delete non-empty office. '); } }
public function doFilter() { if (!Request::ajax()) { App::abort(404); } $offices = Cache::tags('offices')->rememberForever('map_offices_filter_' . md5(json_encode(Input::all())) . '_' . App::getLocale(), function () { return Office::with('city')->active()->filter(Input::all())->orderBy('id_city', 'asc')->get(); }); $officesMap = Office::getMap($offices); $officesPopupsHtml = ''; $officesListHtml = ''; foreach ($officesMap as $officeMap) { $officesPopupsHtml .= View::make('partials.popups.office_info', compact('officeMap'))->render(); $officesListHtml .= View::make('map.partials.list_item', compact('officeMap'))->render(); } return Response::json(array('status' => true, 'offices' => json_encode($officesMap), 'html' => $officesPopupsHtml, 'html_list' => $officesListHtml)); }
public function execute() { if (empty($_POST['latitude']) || empty($_POST['longitude'])) { throw new InvalidParamException(); } $lat = (double) $_POST['latitude']; $lon = (double) $_POST['longitude']; $result = Office::fromDatabaseSearchByCoords($lat, $lon); $content = array(); $content['NumOffices'] = count($result); $content['Offices'] = array(); foreach ($result as $office) { $officeObj = array('Code' => $office['of_code'], 'Name' => $office['of_name'], 'City' => $office['of_city'], 'Address' => $office['of_address'], 'Host' => $office['of_host'], 'Distance' => round($office['of_distance'], 2)); $content['Offices'][] = $officeObj; } return $content; }
public function handleOfficesImport() { $file = Input::file('file'); $folderPath = 'storage/offices/'; $fileName = $file->getClientOriginalName(); $file->move($folderPath, $fileName); $fileResults = Excel::load($folderPath . $fileName, function ($reader) { })->get(); $officesFromFile = array(); foreach ($fileResults as $fileResult) { foreach ($fileResult as $characteristicName => $characteristicValue) { if (isset($fileResult['Номер'])) { $officesFromFile[$fileResult['Номер']][$characteristicName] = $characteristicValue; } } } $translator = new GoogleTranslater(); foreach ($officesFromFile as $officeFromFile) { $city = City::with(array('region' => function ($query) use($officeFromFile) { $query->byTitle(trim($officeFromFile['Область']), 'ua'); }))->byTitle(trim($officeFromFile['Город']), 'ua')->first(); // create city if it doesn't exist if (!$city) { $region = Region::byTitle(trim($officeFromFile['Область']), 'ua')->first(); // get geo coordinates from Google API $geoAddress = 'Україна, ' . $region->title . ' обл., м. ' . trim($officeFromFile['Город']); $geoResult = json_decode(file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?' . http_build_query(array('address' => $geoAddress, 'sensor' => true))), true); $geoLatitude = $geoResult['results'][0]['geometry']['location']['lat']; $geoLongitude = $geoResult['results'][0]['geometry']['location']['lng']; // create city entity $city = City::create(array('id_region' => $region->id, 'title' => trim($officeFromFile['Город']), 'title_ru' => trim($officeFromFile['Город (рус)']), 'title_en' => $translator->translateText(trim($officeFromFile['Город']), "uk", "en"), 'latitude' => isset($geoLatitude) && $geoLatitude ? $geoLatitude : '', 'longitude' => isset($geoLongitude) && $geoLongitude ? $geoLongitude : '', 'is_active' => 1)); if (!$city) { return Response::json(array('status' => false)); } } $officeData = array('id_city' => $city->id, 'number' => trim($officeFromFile['Номер']), 'address' => trim($officeFromFile['Адрес']), 'address_ru' => trim($officeFromFile['Адрес (рус)']), 'address_en' => $translator->translateText(trim($officeFromFile['Адрес']), "uk", "en") ?: '', 'title' => trim($officeFromFile['Название']), 'title_ru' => trim($officeFromFile['Название (рус)']), 'title_en' => $translator->translateText(trim($officeFromFile['Название']), "uk", "en") ?: '', 'description' => trim($officeFromFile['Описание']), 'description_ru' => trim($officeFromFile['Описание (рус)']), 'description_en' => $translator->translateText(trim($officeFromFile['Описание']), "uk", "en") ?: '', 'metro' => trim($officeFromFile['Станции метро']), 'metro_ru' => trim($officeFromFile['Станции метро (рус)']), 'metro_en' => $translator->translateText(trim($officeFromFile['Станции метро']), "uk", "en") ?: '', 'latitude' => trim($officeFromFile['Latitude']), 'longitude' => trim($officeFromFile['Longitude']), 'phones' => trim($officeFromFile['Телефоны']), 'director' => trim($officeFromFile['Директор']), 'director_ru' => trim($officeFromFile['Директор (рус)']), 'director_en' => $translator->translateText(trim($officeFromFile['Директор']), "uk", "en") ?: '', 'services' => trim($officeFromFile['Услуги']), 'services_ru' => trim($officeFromFile['Услуги (рус)']), 'services_en' => $translator->translateText(trim($officeFromFile['Услуги']), "uk", "en") ?: '', 'type' => str_replace(';', ',', trim($officeFromFile['Тип'])), 'atm_type' => str_replace(';', ',', trim($officeFromFile['Тип банкомата'])), 'atm_subtype' => str_replace(';', ',', trim($officeFromFile['Подтип банкомата'])), 'is_active' => trim($officeFromFile['Активность']) == 'Да' ? 1 : 0, 'schedule' => trim($officeFromFile['Режим работы']), 'schedule_ru' => $translator->translateText(trim($officeFromFile['Режим работы']), "uk", "ru") ?: '', 'schedule_en' => $translator->translateText(trim($officeFromFile['Режим работы']), "uk", "en") ?: '', 'schedule_operations' => trim($officeFromFile['Операционная касса']), 'schedule_operations_ru' => $translator->translateText(trim($officeFromFile['Операционная касса']), "uk", "ru") ?: '', 'schedule_operations_en' => $translator->translateText(trim($officeFromFile['Операционная касса']), "uk", "en") ?: '', 'schedule_operations_post' => trim($officeFromFile['Послеоперационная касса']), 'schedule_operations_post_ru' => $translator->translateText(trim($officeFromFile['Послеоперационная касса']), "uk", "ru") ?: '', 'schedule_operations_post_en' => $translator->translateText(trim($officeFromFile['Послеоперационная касса']), "uk", "en") ?: ''); $existedOffice = Office::byNumber(trim($officeFromFile['Номер']))->first(); if (!$existedOffice) { Office::create($officeData); } else { Office::where('number', trim($officeFromFile['Номер']))->update($officeData); } } return Response::json(array('status' => true)); }
public function getTableRows() { $offices = Office::fromDatabaseSearchByCity($this->city); if (!$offices) { return "\n <tr><td colspan=\"4\">Nessun ufficio trovato.</td></tr>"; } $rows = ''; foreach ($offices as $office) { $rows .= <<<EOS <tr> <td>{$office->getCode()}</td> <td>{$office->getName()}</td> <td>{$office->getCity()}</td> <td>{$office->getAddress()}</td> <td><a href="http://{$office->getHost()}">{$office->getHost()}</a></td> </tr> EOS; } return $rows; }
/** * @param string $city * @param bool $openInWeekends * @param bool $hasSupportDesk * @param bool $strict * @return array offices */ public function getOfficesByLocation($city, $openInWeekends, $hasSupportDesk, $strict) { $offices = Office::query(); if (filter_var($openInWeekends, FILTER_VALIDATE_BOOLEAN)) { $offices->where('is_open_in_weekends', '=', 'Y'); } if (filter_var($hasSupportDesk, FILTER_VALIDATE_BOOLEAN)) { $offices->where('has_support_desk', '=', 'Y'); } if (!filter_var($strict, FILTER_VALIDATE_BOOLEAN)) { $bounds = $this->geocoder->geocode($city)->first()->getBounds(); $offices->where('latitude', '<', $bounds->getNorth()); $offices->where('latitude', '>', $bounds->getSouth()); $offices->where('longitude', '<', $bounds->getEast()); $offices->where('longitude', '>', $bounds->getWest()); } else { $offices->where('city', '=', $city); } return $offices->get(); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { // Если админ, то выбираем все опросы. if ($isAdmin = Users::findOne(['profile_id' => Yii::$app->user->identity->username, 'profile_office_role' => 'admin'])) { $officeIds = ArrayHelper::map(Office::find()->all(), 'id', 'id'); } elseif ($isCommercialDirector = Users::findAll(['profile_id' => Yii::$app->user->identity->username, 'profile_office_role' => 'commercial_director'])) { // берем ID отделений, где регион отделения === региону, где пользователь коммерч.директор $regionIds = ArrayHelper::map($isCommercialDirector, 'region_id', 'region_id'); $officeIds = ArrayHelper::map(Office::findAll(['region_id' => $regionIds]), 'id', 'id'); } else { // берем ID отделений, где пользователь является управляющим, или где он назначен им. $officeIds = $this->getOffiсeIds(Yii::$app->user->identity->username); } $query = AnswerList::find()->joinWith('questionList')->where(['do_id' => $officeIds]); //$query = AnswerList::find()->innerJoinWith('questionList'); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]); $sort = $dataProvider->getSort(); $sort->attributes['officeName'] = ['asc' => ['questionlist_office.name' => SORT_ASC], 'desc' => ['questionlist_office.name' => SORT_DESC], 'label' => 'Отделение']; $sort->attributes['statusName'] = ['asc' => ['status' => SORT_ASC], 'desc' => ['status' => SORT_DESC], 'label' => 'Статус']; $dataProvider->setSort($sort); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); $query->joinWith(['questionlist_office']); return $dataProvider; } $query->andFilterWhere(['questionlist_answer_list.id' => $this->id, 'question_list_id' => $this->question_list_id, 'scores' => $this->scores]); $query->andFilterWhere(['>=', 'date_from', $this->date_from])->andFilterWhere(['<=', 'date_to', $this->date_to]); if ($this->statusName) { $query->andFilterWhere(['like', 'status', $this->statusName]); } else { $query->andFilterWhere(['not like', 'status', 'archive']); } $query->joinWith(['office' => function ($q) { $q->andFilterWhere(['like', 'questionlist_office.name', $this->officeName]); }]); return $dataProvider; }
<?php include '../../../lib/department.class.php'; include '../../../lib/office.class.php'; $department = new Department(); $office = new Office(); $depid = $_GET['depid']; $allOfficeName = $office->GetOffices(); $rowOffice = count($allOfficeName); $objDepartment = $department->GetDepartmentsByID($depid); $depOfficeID = $objDepartment["0"]["department_office_id"]; ?> <link href="../../css/stylesheet.css" rel="stylesheet" type="text/css" /> <form id="departmentForm" name="departmentForm" method="post" action="includes/model/department_update_actions.php" > <div id="note"> </div> <div class="vertical_form"> <p> <label>Department Name:</label> <input type="text" class="inventori_txtfield" name="department_name" value="<?php echo $objDepartment["0"]["department_name"]; ?> " id="department_name" /> </p> <p>
function checkMyOffice($oid) { $office = Office::Model()->findByPk($oid); return $office['user_id'] == Yii::app()->user->id; }
echo $form->label($model, 'fathers_name'); ?> <?php echo $form->textField($model, 'fathers_name', array('size' => 40, 'maxlength' => 40)); ?> </div> <div class="row"> <?php echo $form->label($model, 'office'); ?> <?php //echo $form->textField($model,'office'); ?> <?php echo $form->dropDownList($model, 'office', CHtml::listData(Office::model()->findAll(), 'of_id', 'of_name'), array('prompt' => 'Select office')); ?> </div> <div class="row"> <?php echo $form->label($model, 'department'); ?> <?php //echo $form->textField($model,'department'); ?> <?php echo $form->dropDownList($model, 'department', CHtml::listData(Department::model()->findAll(), 'dep_id', 'dep_name'), array('prompt' => 'Select department')); ?> </div>
<div class="full-width-input-wrapper"> <?php $fullAddressString = isset($_GET['Property']['fullAddressString']) ? $_GET['Property']['fullAddressString'] : ''; echo CHtml::textField('Property[fullAddressString]', $fullAddressString, ['class' => 'search input-large', 'placeholder' => 'Address']); ?> </div> </div> <div class="row"> <div class="half-cell"> <label class="block-label">Branch</label> <div class="input-wrapper"> <?php $branch = isset($deal['dea_branch']) ? $deal['dea_branch'] : null; echo CHtml::dropDownList('Deal[dea_branch]', $branch, CHtml::listData(Office::model()->getShortBranchList($type), 'bra_id', 'shortTitle'), ['empty' => 'All']); ?> </div> </div> <div class="half-cell"> <label class="block-label">Type of Property</label> <div class="input-wrapper"> <?php $propertyType = isset($deal['dea_ptype']) ? $deal['dea_ptype'] : ""; echo CHtml::dropDownList('Deal[dea_ptype]', $propertyType, CHtml::listData(PropertyType::model()->getPublicSiteTypes($type), 'pty_id', 'pty_title'), ['empty' => 'All']); ?> </div> </div> </div>
public function executeDailyLog(sfWebRequest $request) { $this->form = new ReportDailyLogForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) { $month = $this->form->getValue('date_month'); $this->year = $year = $this->form->getValue('date_year'); $first_day = mktime(0, 0, 0, $month, 1, $year); $last_day = strtotime('+1 month -1 second', $first_day); $c = new Criteria(); // only in this date range (the month selected) $c->add(NoteEntryPeer::SERVICE_DATE, $first_day, Criteria::GREATER_EQUAL); $c->addAnd(NoteEntryPeer::SERVICE_DATE, $last_day, Criteria::LESS_EQUAL); // include absent? lets go with no $c->add(NoteEntryPeer::ABSENT, 0); // sort by kids name $c->addAscendingOrderByColumn(ClientPeer::LAST_NAME); $c->addAscendingOrderByColumn(NoteEntryPeer::SERVICE_DATE); $c->addAscendingOrderByColumn(NoteEntryPeer::TIME_IN); // only the selected type if ($this->form->getValue('service_type')) { $c->add(ClientServicePeer::OBJECT_TYPE, $this->form->getValue('service_type')); } $entries = NoteEntryPeer::doSelectJoinAll($c); // build array of all entries in the selected time period indexed by ID $this->all_entries = array(); foreach ($entries as $entry) { $this->all_entries[$entry->getId()] = $entry; } // build an array of overlaps of client $this->overlaps = array(); $client_entry_times = array(); $provider_entry_times = array(); foreach ($this->all_entries as $anEntry) { // skip grouped kids, for now if (!$anEntry->inGroup()) { if (!array_key_exists($anEntry->getEmployeeId(), $provider_entry_times)) { $provider_entry_times[$anEntry->getEmployeeId()] = array(); } $provider_entry_times[$anEntry->getEmployeeId()][$anEntry->getId()] = array($anEntry->getTimeIn('U'), $anEntry->getTimeOut('U')); } if (!array_key_exists($anEntry->getClientId(), $client_entry_times)) { $client_entry_times[$anEntry->getClientId()] = array(); } $client_entry_times[$anEntry->getClientId()][$anEntry->getId()] = array($anEntry->getTimeIn('U'), $anEntry->getTimeOut('U')); } // find clients with overlapping times foreach ($client_entry_times as $client_id => $client_entries) { $entry_times[$client_id] = sort2d($client_entries, 0); $previous = array(0, 0, 0); foreach ($entry_times[$client_id] as $entry_id => $times) { // this in time happened before previous out time.. we have a overlap if ($times[0] < $previous[1] && $entry_id != $previous[2]) { $this->overlaps[$entry_id] = $previous[2]; $this->overlaps[$previous[2]] = $entry_id; } $previous = array($times[0], $times[1], $entry_id); } } // find providers with overlapping times foreach ($provider_entry_times as $client_id => $client_entries) { $entry_times[$client_id] = sort2d($client_entries, 0); $previous = array(0, 0, 0); foreach ($entry_times[$client_id] as $entry_id => $times) { // this in time happened before previous out time.. we have a overlap if ($times[0] < $previous[1] && $entry_id != $previous[2]) { $this->overlaps[$entry_id] = $previous[2]; $this->overlaps[$previous[2]] = $entry_id; } $previous = array($times[0], $times[1], $entry_id); } } // initialize $this->classrooms = array(); // foreach($this->overlaps as $key => $blah) { echo $key .' => '. $blah->getId() .'<br />'; } // die(); foreach ($this->all_entries as $entry) { // only kids that have been serviced by this employee if (!$this->form->getValue('employee_id') || $this->form->getValue('employee_id') == $entry->getEmployeeId()) { $office = $entry->getOffice(); $client = $entry->getClient(); $week = $entry->getServiceDate('W'); if (!is_object($office)) { $office = new Office(); $office->setName('N/A'); } // let's see if we have entered any for this classroom yet if (!array_key_exists($office->getName(), $this->classrooms)) { $this->classrooms[$office->getName()] = array_fill_keys(range(date('W', $first_day), date('W', $last_day)), array()); } // initialize the row for this kid if (!array_key_exists($week, $this->classrooms[$office->getName()]) || !array_key_exists($client->getFullName(), $this->classrooms[$office->getName()][$week])) { $days = array(); for ($day = 1; $day <= 5; $day++) { $days[date('m/d/Y', strtotime($entry->getServiceDate('Y') . "W" . $week . $day))] = array(); } $this->classrooms[$office->getName()][$week][$client->getFullName()] = $days; } // save the entry to the appropriate cell in the table $this->classrooms[$office->getName()][$week][$client->getFullName()][$entry->getServiceDate('m/d/Y')][] = $entry; } } // $weeks = array( // 'week_num' => array( // 'client_name' => array( // 'date' => array( // 'service_type' => 'cell data, time, absent, etc.' // ) // ) // ) // ); return 'Report'; } } }
public function loadModel($id) { $model = Office::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'Запись не найдена.'); } return $model; }
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(); try { JobPeer::doDeleteAll($connection); foreach ($jobs as $job) { $this->logSection('job', 'reading job ' . $job['job_title']); $j1 = new Job(); $j1->setName($job['job_title']); $j1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // SERVICES $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_services'); $statement = $source->prepare($query); $statement->execute(); $services = $statement->fetchAll(); $connection->beginTransaction(); try { ServicePeer::doDeleteAll($connection); foreach ($services as $service) { $this->logSection('service', 'reading service ' . $service['service_title']); $s1 = new Service(); $s1->setName($service['service_title']); $s1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // EMPLOYEES $query = 'SELECT * FROM %s LEFT JOIN (%s) ON (%s.emp_job_title = %s.job_id)'; $query = sprintf($query, 'tbl_employee', 'tbl_job', 'tbl_employee', 'tbl_job'); $statement = $source->prepare($query); $statement->execute(); $employees = $statement->fetchAll(); $connection->beginTransaction(); try { EmployeePeer::doDeleteAll($connection); foreach ($employees as $employee) { $this->logSection('employee', 'reading employee ' . $employee['emp_id']); $emp = new Employee(); $emp_fields = array('clearance' => $employee['emp_scr_clearance'], 'first_name' => $employee['emp_fn'], 'middle' => $employee['emp_mi'], 'last_name' => $employee['emp_ln'], 'address' => $employee['emp_address'], 'address_2' => $employee['emp_address2'], 'city' => $employee['emp_city'], 'state' => $employee['emp_state'], 'zip' => $employee['emp_zip'], 'home_phone' => $employee['emp_phone'], 'cell_phone' => $employee['emp_cell'], 'company_email' => $employee['emp_email'], 'personal_email' => $employee['emp_p_email'], 'license_number' => $employee['emp_license_number'], 'license_expiration' => $employee['emp_license_exp'], 'dob' => $employee['emp_dob'], 'doh' => $employee['emp_hire_date'], 'dof' => $employee['emp_end_date'], 'ssn' => $employee['emp_ssn'], 'health_insurance' => $employee['emp_health'], 'retirement_plan' => $employee['emp_401k'], 'suplimental_health' => $employee['emp_health_sup'], 'health_type' => $employee['emp_health_type'], 'tb_date' => $employee['emp_tb'], 'osha_date' => $employee['emp_osha'], 'cpr_date' => $employee['emp_cpr'], 'finger_prints' => $employee['emp_fp'], 'finger_print_notes' => $employee['emp_fp_n'], 'notes' => $employee['emp_notes']); $emp->fromArray($emp_fields, BasePeer::TYPE_FIELDNAME); // find the job - check for errors $emp->setJob(JobPeer::getByName($employee['job_title'])); // if physical has a date then create a new physical object for employee if ($employee['emp_physical']) { $this->logSection('physical', 'employee ' . $employee['emp_fn'] . ' had a physical on ' . $employee['emp_physical']); $ph1 = new Physical(); $ph1->setEmployee($emp); $ph1->setDateGiven($employee['emp_physical']); $ph1->save($connection); } $emp->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // read in and create client objects - linking to employee // CLIENTS $query = 'SELECT * FROM %s LEFT JOIN (%s) ON (%s.client_district = %s.district_id)'; $query = sprintf($query, 'tbl_client', 'tbl_district', 'tbl_client', 'tbl_district'); $statement = $source->prepare($query); $statement->execute(); $clients = $statement->fetchAll(); $connection->beginTransaction(); try { ClientPeer::doDeleteAll($connection); foreach ($clients as $client) { $this->logSection('client', 'reading client ' . $client['client_ln']); $cl = new Client(); $client_fields = array('first_name' => $client['client_fn'], 'last_name' => $client['client_ln'], 'dob' => $client['client_dob'], 'parent_first' => $client['client_parent_fn'], 'parent_last' => $client['client_parent_ln'], 'address' => $client['client_address'], 'address_2' => $client['client_address2'], 'city' => $client['client_city'], 'state' => $client['client_state'], 'zip' => $client['client_zip'], 'home_phone' => $client['home_phone'], 'work_phone' => $client['work_phone'], 'cell_phone' => $client['cell_phone'], 'blue_card' => $client['blue_card'], 'physical_exp' => $client['physical_exp_date'], 'immunizations' => $client['immunizations'], 'waiting_list' => $client['waiting_list']); // county $cl->setCounty(CountyPeer::getByName($client['client_county'])); // district $cl->setDistrict(DistrictPeer::getByName($client['district_name'])); $cl->fromArray($client_fields, BasePeer::TYPE_FIELDNAME); $cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // CLIENT SERVICES // CLASSROOM $query = 'SELECT * FROM tbl_classroom LEFT JOIN (tbl_client) ON (tbl_classroom.class_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_classroom.class_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_classroom.class_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_classroom.class_freq_id = tbl_frequency.freq_id)'; $statement = $source->prepare($query); $statement->execute(); $classrooms = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_CLASSROOM); try { ClientServicePeer::doDelete($c, $connection); foreach ($classrooms as $classroom) { $this->logSection('classroom', 'reading service ' . $classroom['class_id']); $cr_cl = new Classroom(); $cr_cl->setStartDate($classroom['class_start_date']); $cr_cl->setEndDate($classroom['class_exp_date']); $cr_cl->setChangeDate($classroom['class_chng_date']); $cr_cl->setNotes($classroom['class_notes']); // client $cr_cl->setClient(ClientPeer::getByFullName($classroom['client_fn'], $classroom['client_ln'])); // employee $cr_cl->setEmployee(EmployeePeer::getByFullName($classroom['emp_fn'], $classroom['emp_ln'])); // service $cr_cl->setService(ServicePeer::getByName($classroom['service_title'])); // frequency $cr_cl->setFrequency(FrequencyPeer::getByName($classroom['freq_title'])); // office $cr_cl->setOffice(OfficePeer::getByName($classroom['class_location'])); $cr_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // EI $query = 'SELECT * FROM tbl_ei LEFT JOIN (tbl_client) ON (tbl_ei.ei_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_ei.ei_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_ei.ei_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_ei.ei_freq_id = tbl_frequency.freq_id) LEFT JOIN (tbl_icd9) ON (tbl_ei.ei_icd9_id = tbl_icd9.icd9_id)'; $statement = $source->prepare($query); $statement->execute(); $eis = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_EI); try { ClientServicePeer::doDelete($c, $connection); foreach ($eis as $ei) { $this->logSection('ei', 'reading service ' . $ei['ei_id']); $ei_cl = new Ei(); $ei_cl->setStartDate($ei['ei_start_date']); $ei_cl->setEndDate($ei['ei_exp_date']); $ei_cl->setChangeDate($ei['ei_chng_date']); $ei_cl->setNotes($ei['ei_serv_notes']); $ei_cl->setAuthorization($ei['ei_auth']); $ei_cl->setPhysiciansOrder($ei['ei_p_order']); // client $ei_cl->setClient(ClientPeer::getByFullName($ei['client_fn'], $ei['client_ln'])); // employee $ei_cl->setEmployee(EmployeePeer::getByFullName($ei['emp_fn'], $ei['emp_ln'])); // service $ei_cl->setService(ServicePeer::getByName($ei['service_title'])); // frequency $ei_cl->setFrequency(FrequencyPeer::getByName($ei['freq_title'])); // office $ei_cl->setIcd9(Icd9Peer::getByName($ei['icd9_value'])); $ei_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // PRESCHOOL $query = 'SELECT * FROM tbl_preschool LEFT JOIN (tbl_client) ON (tbl_preschool.pre_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_preschool.pre_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_preschool.pre_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_preschool.pre_freq_id = tbl_frequency.freq_id)'; $statement = $source->prepare($query); $statement->execute(); $preschools = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_PRESCHOOL); try { ClientServicePeer::doDelete($c, $connection); foreach ($preschools as $preschool) { $this->logSection('preschool', 'reading service ' . $preschool['pre_id']); $pr_cl = new Preschool(); $pr_cl->setStartDate($preschool['pre_start_date']); $pr_cl->setEndDate($preschool['pre_exp_date']); $pr_cl->setChangeDate($preschool['pre_chng_date']); // client $pr_cl->setClient(ClientPeer::getByFullName($preschool['client_fn'], $preschool['client_ln'])); // employee $pr_cl->setEmployee(EmployeePeer::getByFullName($preschool['emp_fn'], $preschool['emp_ln'])); // service $pr_cl->setService(ServicePeer::getByName($preschool['service_title'])); // frequency $pr_cl->setFrequency(FrequencyPeer::getByName($preschool['freq_title'])); $pr_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // SEIT $query = 'SELECT * FROM tbl_seit LEFT JOIN (tbl_client) ON (tbl_seit.seit_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_seit.seit_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_seit.seit_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_seit.seit_freq_id = tbl_frequency.freq_id)'; $statement = $source->prepare($query); $statement->execute(); $seits = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_SEIT); try { ClientServicePeer::doDelete($c, $connection); foreach ($seits as $seit) { $this->logSection('seit', 'reading service ' . $seit['seit_id']); $seit_cl = new Seit(); $seit_cl->setStartDate($seit['seit_start_date']); $seit_cl->setEndDate($seit['seit_exp_date']); $seit_cl->setChangeDate($seit['seit_chng_date']); $seit_cl->setNotes($seit['seit_notes']); // client $seit_cl->setClient(ClientPeer::getByFullName($seit['client_fn'], $seit['client_ln'])); // employee $seit_cl->setEmployee(EmployeePeer::getByFullName($seit['emp_fn'], $seit['emp_ln'])); // service $seit_cl->setService(ServicePeer::getByName($seit['service_title'])); // frequency $seit_cl->setFrequency(FrequencyPeer::getByName($seit['freq_title'])); $seit_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } }
public function scopeBySearchPhrase($query, $phrase) { $phrase = trim($phrase); if (!$phrase) { return $query; } // by city name $citiesIds = City::active()->searchByTitle($phrase)->lists('id'); if ($citiesIds) { return $query->byCity($citiesIds); } // by metro station $officesIds = Office::active()->searchByMetro($phrase)->lists('id'); if ($officesIds) { return $query->whereIn('id', $officesIds); } // by address return $query->byAddress($phrase); }
public function deleteJob($oid, $mid) { $office = Office::Model()->findByPk($oid); if ($office['user_id'] == Yii::app()->user->id) { $res = $this->findByPk($mid); $res->delete(); } }
<?php require_once "../../lib/office.class.php"; $objOfficeUpdate = new Office(); $officeID = $_POST['officeID']; $officeName = $_POST['officeName']; $address = $_POST['address']; $phone = $_POST['phone']; $mail = $_POST['mail']; if ($officeID != NULL) { $objOfficeUpdate->updateOfficeGroup($officeID, $officeName, $address, $phone, $mail); echo "<b>Data Save Successsfull<b>"; }
</h4> </td> </tr> <tr> <td class="proc-headers" width="20%"><h5><strong>Requisitioner<strong></h5></td> <td class="proc-data"> <?php $user = User::find($purchase->requisitioner); ?> {{ $user->lastname . ", " . $user->firstname }} </td> <td class="proc-data"><strong>Office<strong></td> <td class="proc-data"> <?php $office = Office::find($purchase->office); ?> {{ $office->officeName }} </td> </tr> <tr> <td class="proc-headers"><h5><strong>Project / Purpose</strong></h5></td> <td class="proc-data">{{ $purchase->projectPurpose }}</td> <td class="proc-headers"><h5><strong>Project Type</strong></h5></td> <td class="proc-data">{{ $purchase->projectType }}</td> </tr> <tr> <td class="proc-data"><strong>ABC Amount</strong></td>
<?php echo $form->passwordField($model, 'passR'); ?> <?php echo $form->error($model, 'passR'); ?> </div> </div> <div class="fl ml40"> <div class="enter-form-row data-header"> <?php echo $form->labelEx($model, 'office_id'); ?> <div class="select-wrap"> <?php echo $form->dropDownList($model, 'office_id', CHtml::listData(Office::items(), 'id', 'value')); ?> </div> <?php echo $form->error($model, 'office_id'); ?> <a href="javascript:void(0)" class="custom-link fa_custom-link">Добавить</a> </div> <div class="enter-form-row"> <?php echo $form->labelEx($model, 'phone'); ?> <?php echo $form->textField($model, 'phone'); ?> <?php