public function editBuildingAction() { $id = (int) $this->_getParam('id'); $enumerationId = (int) $this->_getParam('enumerationId'); $enumerationsClosure = new EnumerationsClosure(); $parentId = $enumerationsClosure->getParentById($enumerationId); $enumeration = new Enumeration(); $enumeration->enumerationId = $parentId; $enumeration->populate(); $orm = new Building(); if ($id > 0) { $orm->buildingId = $id; $orm->populate(); } $orm->practiceId = $enumeration->ormId; $form = new WebVista_Form(array('name' => 'edit-building')); $form->setAction(Zend_Registry::get('baseUrl') . 'facilities.raw/process-edit-building'); $form->loadORM($orm, 'Building'); $form->setWindow('windowEditBuildingId'); $this->view->form = $form; $this->view->enumerationId = $enumerationId; $this->view->statesList = Address::getStatesList(); $enumeration = new Enumeration(); $enumeration->guid = '22fb4e1e-a37a-4e7a-9dae-8e220ba939e8'; $enumeration->populateByGuid(); $enumerationClosure = new EnumerationClosure(); $descendants = $enumerationClosure->getAllDescendants($enumeration->enumerationId, 1, true); $facilityCodes = array('' => ''); foreach ($descendants as $descendant) { $facilityCodes[$descendant->key] = $descendant->key . ' : ' . $descendant->name; } $this->view->facilityCodes = $facilityCodes; $this->render('edit-building'); }
/** * Internal function to return a Building object from a row. * @param $row array * @return Building */ function &_returnBuildingFromRow(&$row) { $building = new Building(); $building->setId($row['building_id']); $building->setSchedConfId($row['sched_conf_id']); $this->getDataObjectSettings('building_settings', 'building_id', $row['building_id'], $building); return $building; }
protected function getAsObject($row) { $result = new Building(); $result->setNew(false); $result->setBuildingId(Singleton::create("NullConverter")->fromDBtoDOM($row["buildingId"])); $result->setName(Singleton::create("NullConverter")->fromDBtoDOM($row["name"])); return $result; }
public function add_buildings() { for ($i = 0; $i < $this->buildcount; $i++) { $building = new Building($i + 1, rand(1, 16), rand(1, 6), rand(4, 6), rand(1000, 2000)); $building->addflats(); $this->arr_of_buildings[] = $building; //$building->display(); } }
function encoder_redirect_success(Building $building) { $building_name = $building->getName(); $building_name_amharic = $building->getNameAmharic(); $dir = "VIEW/html/Encoder/Add_Building/Add_Building.php?success=1&building_name={$building_name}&building_name_amharic={$building_name_amharic}"; $url = BASE_URL . $dir; header("Location:{$url}"); //redirect the encoder to the regions add place exit; }
public function indexAction() { $personId = (int) $this->_getParam('personId'); $visitId = (int) $this->_getParam('visitId'); $identity = Zend_Auth::getInstance()->getIdentity(); $this->view->providerId = (int) $identity->personId; $this->view->personId = $personId; $insuredRelationship = new InsuredRelationship(); $insuredRelationship->personId = $personId; $insurancePrograms = array('0' => ''); foreach ($insuredRelationship->getProgramList() as $key => $value) { $insurancePrograms[$key] = $value; } $this->view->insurancePrograms = $insurancePrograms; $visit = new Visit(); $visit->visitId = $visitId; if (!$visit->populate()) { $visit->visitId = 0; $visit->dateOfTreatment = date('Y-m-d'); } $this->view->visit = $visit; $this->view->room = Building::getBuildingDefaultLocation($this->view->providerId, (int) $identity->default_location_id); $facilityIterator = new FacilityIterator(); $this->view->facilityIterator = $facilityIterator; $facilityIterator->setFilter(array('Practice')); $this->view->practices = $facilityIterator->toArray('practiceId', 'name'); $provider = new Provider(); $providerIterator = $provider->getIter(); $this->view->providers = $providerIterator->toArray('personId', 'displayName'); $this->render(); }
/** * Store a newly created resource in storage. * POST /adminimages * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Image::$rules); if ($validator->fails()) { //return Redirect::back()->withErrors($validator)->withInput(); return Response::json('Upload Error', 400); } if ($data['code'] !== 0) { $building = Building::where('code', '=', $data['code'])->firstOrFail(); $building_id = $building->id; } else { $building_id = '0'; } $file = Input::file('file'); $img_destination = 'public/assets/uploads/img/'; $extension = $file->getClientOriginalExtension(); $img_name = rand(11111, 99999) . '.' . $extension; $data = array('file' => $img_name, 'building_id' => $building_id); //dd($building->id); $upload = $file->move($img_destination, $img_name); if ($upload) { Image::create($data); return Response::json($file, 200); } return Response::json('error', 400); //return Redirect::route('admin.images'); }
public function getSettings() { $id = Input::get('id'); $building = Building::find($id); $settings = $building->settings()->get(); return Response::json($settings); }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { $size = rand(100, 300); Building::create(['title' => $faker->realText(10), 'type' => $faker->firstName(), 'code' => rand(1000, 3000), 'building_size' => $size, 'area_size' => $size + 50, 'location' => $faker->address(), 'status_id' => rand(1, 3), 'detail' => $faker->realText(500), 'price' => '250.000.000', 'user_id' => rand(1, 3)]); } }
protected function buildNavBar() { parent::buildNavBar(); $this->navbar->popEntry(); if ($this->isNew()) { $this->navbar->createEntry(Building::_('New Text Content')); } else { $this->navbar->createEntry(Building::_('Edit Text Content')); } }
static function buildingOptions() { $criteria = new CDbCriteria(); $criteria->select = 'building_id'; $model = Building::model()->findAll(); $buildings = array('' => '请选择相应楼栋'); foreach ($model as $row) { $buildings[$row->building_id] = $row->building_id . '号'; } return $buildings; }
protected function processDBData() { parent::processDBData(); $sql = 'delete from Block where id in (%s)'; $item_list = $this->getItemList('integer'); $sql = sprintf($sql, $item_list); $num = SwatDB::exec($this->app->db, $sql); if ($num > 0) { $this->app->messages->add(new SwatMessage(Building::_('Content has been deleted.'))); } }
public function editBuildingAction() { $id = (int) $this->_getParam('id'); $enumerationId = (int) $this->_getParam('enumerationId'); $enumerationsClosure = new EnumerationsClosure(); $parentId = $enumerationsClosure->getParentById($enumerationId); $enumeration = new Enumeration(); $enumeration->enumerationId = $parentId; $enumeration->populate(); $orm = new Building(); if ($id > 0) { $orm->buildingId = $id; $orm->populate(); } $orm->practiceId = $enumeration->ormId; $form = new WebVista_Form(array('name' => 'edit-building')); $form->setAction(Zend_Registry::get('baseUrl') . 'facilities.raw/process-edit-building'); $form->loadORM($orm, 'Building'); $form->setWindow('windowEditBuildingId'); $this->view->form = $form; $this->view->enumerationId = $enumerationId; $this->render('edit-building'); }
/** * Save building. */ function execute() { $buildingDao = DAORegistry::getDAO('BuildingDAO'); $schedConf =& Request::getSchedConf(); if (isset($this->buildingId)) { $building =& $buildingDao->getBuilding($this->buildingId); } if (!isset($building)) { $building = new Building(); } $building->setSchedConfId($schedConf->getId()); $building->setName($this->getData('name'), null); // Localized $building->setAbbrev($this->getData('abbrev'), null); // Localized $building->setDescription($this->getData('description'), null); // Localized // Update or insert building if ($building->getId() != null) { $buildingDao->updateBuilding($building); } else { $buildingDao->insertBuilding($building); } }
public function handleRequest($command) { switch ($command) { case 'get': $buildings = Building::getAll(); break; default: throw new Exception("Unsupported property!"); break; } if (empty($buildings)) { throw new Exception("Nothing found"); } $formattedBuildings = Building::format($buildings); //echo json_encode($formattedBuildings); render('building', array('buildings' => $formattedBuildings)); }
function createBuilding() { $building = new Building("Elevator Towers"); $floor1 = $building->addFloorVia(); $floor2 = $building->addFloorVia(); $floor3 = $building->addFloorVia(); $floor4 = $building->addFloorVia(); $up1 = new UpRequest(false, $floor1); $up2 = new UpRequest(false, $floor2); $up3 = new UpRequest(false, $floor3); $down2 = new DownRequest(false, $floor2); $down3 = new DownRequest(false, $floor3); $down4 = new DownRequest(false, $floor4); $elevator1 = $building->addElevatorVia("up", true); $elevator1->setFloor($floor2); $floor3->addWaitingPerson(new Person("Dru")); $floor3->addWaitingPerson(new Person("Tim")); $floor3->addWaitingPerson(new Person("Omar")); return $building; }
public static function handlerSSSourceData(Audit $audit) { $data = array(); if ($audit->objectClass != 'ESignature') { return $data; } $eSignature = new ESignature(); $eSignature->eSignatureId = $audit->objectId; $eSignature->populate(); if ($eSignature->objectClass != 'Medication' || !strlen($eSignature->signature) > 0) { WebVista::log('esignature is not signed or medication'); return $data; } // MEDICATION DATA $medication = new Medication(); $medication->medicationId = (int) $eSignature->objectId; $medication->populate(); if ($medication->transmit != 'ePrescribe' || $medication->isScheduled()) { WebVista::log('medication is either scheduled or not an eprescribe'); return $data; } WebVista::log('generating source data'); $data['_audit'] = $audit; $uuid = NSDR::create_guid(); $data['messageId'] = str_replace('-', '', $uuid); $data['prescriberOrderNumber'] = $medication->medicationId . '_' . $audit->auditId; $data['rxReferenceNumber'] = $medication->rxReferenceNumber; WebVista::log('messageId:[' . $data['messageId'] . '] prescriberOrderNumber:[' . $data['prescriberOrderNumber'] . '], rxReferenceNumber:[' . $data['rxReferenceNumber'] . ']'); $medData = array(); $medData['description'] = $medication->description; $medData['strength'] = $medication->dose; $qualifiers = Medication::listQuantityQualifiersMapping(); $medData['strengthUnits'] = $qualifiers[$medication->quantityQualifier]; // temporarily set to the same with quantity $medData['quantity'] = $medication->quantity; $medData['quantityUnits'] = $qualifiers[$medication->quantityQualifier]; $medData['daysSupply'] = $medication->daysSupply; $medData['directions'] = $medication->directions; $qualifier = 'R'; if ($medication->prn) { $qualifier = 'PRN'; } $medData['refills'] = $medication->refills; $medData['refillsUnits'] = $qualifier; $medData['substitutions'] = $medication->substitution ? '0' : '1'; $writtenDate = date('Ymd', strtotime($medication->datePrescribed)); if ($medication->datePrescribed == '0000-00-00 00:00:00') { $writtenDate = ''; } $medData['writtenDate'] = $writtenDate; $medData['productCode'] = $medication->hipaaNDC; $medData['productQualifier'] = 'ND'; $medData['dosageForm'] = DataTables::getDosageForm($medication->chmedDose); $medData['drugDBCode'] = $medication->pkey; $medData['drugDBQualifier'] = ''; //'pkey'; valid options: "E|G|FG|FS|MC|MD|MG|MM" $medData['note'] = $medication->comment; $data['Medication'] = $medData; WebVista::log('medication data: ' . print_r($medData, true)); // PHARMACY DATA $pharmacy = new Pharmacy(); $pharmacy->pharmacyId = $medication->pharmacyId; $pharmacy->populate(); $pharmacyData = array(); $pharmacyData['NCPDPID'] = $pharmacy->NCPDPID; $pharmacyData['fileId'] = $pharmacy->pharmacyId; $pharmacyData['NPI'] = $pharmacy->NPI; $pharmacyData['storeName'] = $pharmacy->StoreName; $pharmacyData['storeNumber'] = $pharmacy->StoreNumber; $pharmacyData['email'] = $pharmacy->Email; $pharmacyData['twentyFourHourFlag'] = $pharmacy->TwentyFourHourFlag; $pharmacyData['crossStreet'] = $pharmacy->CrossStreet; $pharmacyData['addressLine1'] = $pharmacy->AddressLine1; $pharmacyData['addressLine2'] = $pharmacy->AddressLine2; $pharmacyData['city'] = $pharmacy->City; $pharmacyData['state'] = $pharmacy->State; $pharmacyData['zip'] = $pharmacy->Zip; $phones = array(); $phones[] = array('number' => $pharmacy->PhonePrimary, 'type' => 'TE'); $phones[] = array('number' => $pharmacy->Fax, 'type' => 'FX'); $phones[] = array('number' => $pharmacy->PhoneAlt1, 'type' => $pharmacy->PhoneAlt1Qualifier); $phones[] = array('number' => $pharmacy->PhoneAlt2, 'type' => $pharmacy->PhoneAlt2Qualifier); $phones[] = array('number' => $pharmacy->PhoneAlt3, 'type' => $pharmacy->PhoneAlt3Qualifier); $phones[] = array('number' => $pharmacy->PhoneAlt4, 'type' => $pharmacy->PhoneAlt4Qualifier); $phones[] = array('number' => $pharmacy->PhoneAlt5, 'type' => $pharmacy->PhoneAlt5Qualifier); $pharmacyData['phones'] = $phones; $data['Pharmacy'] = $pharmacyData; WebVista::log('pharmacy data: ' . print_r($pharmacyData, true)); // PRESCRIBER DATA $provider = new Provider(); $provider->personId = $medication->prescriberPersonId; $provider->populate(); $prescriberData = array(); $prescriberData['DEANumber'] = $provider->deaNumber; // it has conflicts with DEANumber //$prescriberData['stateLicenseNumber'] = $provider->stateLicenseNumber; $prescriberData['fileId'] = $provider->personId; $prescriberData['clinicName'] = ''; $identifierType = $provider->identifierType; if (strlen($identifierType) > 0) { // $prescriberData[$identifierType] = $provider->identifier; } $prescriberData['lastName'] = $provider->person->lastName; $prescriberData['firstName'] = $provider->person->firstName; $prescriberData['middleName'] = $provider->person->middleName; $prescriberData['suffix'] = $provider->person->suffix; $prescriberData['prefix'] = ''; $prescriberData['email'] = $provider->person->email; $prescriberData['specialtyCode'] = $provider->specialty; $specialtyQualifier = ''; if (strlen($provider->specialty) > 0) { $specialtyQualifier = 'AM'; } $prescriberData['specialtyQualifier'] = $specialtyQualifier; $building = Building::getBuildingDefaultLocation((int) $provider->personId); $ePrescriber = new EPrescriber(); $ePrescriber->providerId = (int) $provider->personId; $ePrescriber->buildingId = (int) $building->buildingId; $ePrescriber->populateWithBuildingProvider(); $prescriberData['SPI'] = $ePrescriber->SSID; $prescriberData['addressLine1'] = $building->line1; $prescriberData['addressLine2'] = $building->line2; $prescriberData['city'] = $building->city; $prescriberData['state'] = $building->state; $prescriberData['zip'] = $building->zipCode; $prescriberData['phones'] = $building->phoneNumbers; $data['Prescriber'] = $prescriberData; WebVista::log('prescriber data: ' . print_r($prescriberData, true)); // PATIENT DATA $patient = new Patient(); $patient->personId = $medication->personId; $patient->populate(); $patientData = array(); $patientData['lastName'] = $patient->person->lastName; $patientData['firstName'] = $patient->person->firstName; $patientData['middleName'] = $patient->person->middleName; $patientData['suffix'] = $patient->person->suffix; $patientData['prefix'] = ''; $patientData['email'] = $patient->person->email; $patientData['fileId'] = $patient->recordNumber; $patientData['medicareNumber'] = ''; // TODO: to be implemented $identifierType = $patient->identifierType; if (strlen($identifierType) > 0) { $patientData[$identifierType] = $patient->identifier; } $patientData['gender'] = $patient->person->getDisplayGender(); $dateOfBirth = date('Ymd', strtotime($patient->person->dateOfBirth)); if ($patient->person->dateOfBirth == '0000-00-00') { $dateOfBirth = ''; } $patientData['dateOfBirth'] = $dateOfBirth; $address = new Address(); $address->personId = $patient->personId; $addressIterator = $address->getIteratorByPersonId(); foreach ($addressIterator as $address) { break; // retrieves the top address } $patientData['addressLine1'] = $address->line1; $patientData['addressLine2'] = $address->line2; $patientData['city'] = $address->city; $patientData['state'] = $address->state; $patientData['zip'] = $address->zipCode; $phoneNumber = new PhoneNumber(); $phoneNumber->personId = $patient->personId; $patientData['phones'] = $phoneNumber->phoneNumbers; $data['Patient'] = $patientData; WebVista::log('patient data: ' . print_r($patientData, true)); // CHECK for attending/supervisor $attendingId = (int) TeamMember::getAttending($patient->teamId); $building = Building::getBuildingDefaultLocation($attendingId); $ePrescriber = new EPrescriber(); $ePrescriber->providerId = $attendingId; $ePrescriber->buildingId = (int) $building->buildingId; $ePrescriber->populateWithBuildingProvider(); if ($attendingId > 0 && strlen($ePrescriber->SSID) > 0) { // SUPERVISOR $provider = new Provider(); $provider->personId = $attendingId; $provider->populate(); $supervisorData = array(); $supervisorData['DEANumber'] = $provider->deaNumber; $supervisorData['SPI'] = $ePrescriber->SSID; // it has conflicts with DEANumber //$supervisorData['stateLicenseNumber'] = $provider->stateLicenseNumber; $supervisorData['fileId'] = $provider->personId; $supervisorData['clinicName'] = ''; $identifierType = $provider->identifierType; if (strlen($identifierType) > 0) { // $prescriberData[$identifierType] = $provider->identifier; } $phoneNumber = new PhoneNumber(); $phoneNumber->personId = $provider->personId; $supervisorData['phones'] = $phoneNumber->phoneNumbers; $supervisorData['lastName'] = $provider->person->lastName; $supervisorData['firstName'] = $provider->person->firstName; $supervisorData['middleName'] = $provider->person->middleName; $supervisorData['suffix'] = $provider->person->suffix; $supervisorData['prefix'] = ''; $supervisorData['email'] = $provider->person->email; $supervisorData['specialtyCode'] = $provider->specialty; $specialtyQualifier = ''; if (strlen($provider->specialty) > 0) { $specialtyQualifier = 'AM'; } $supervisorData['specialtyQualifier'] = $specialtyQualifier; $supervisorData['addressLine1'] = $building->line1; $supervisorData['addressLine2'] = $building->line2; $supervisorData['city'] = $building->city; $supervisorData['state'] = $building->state; $supervisorData['zip'] = $building->zipCode; $supervisorData['phones'] = $building->phoneNumbers; $data['Supervisor'] = $supervisorData; WebVista::log('supervisor data: ' . print_r($supervisorData, true)); } return $data; }
protected function _populateScheduleEventRow(ScheduleEvent $event, array &$columnData, $colIndex) { $buildings = array(); $eventTimeStart = strtotime($event->start); $eventTimeEnd = strtotime($event->end); // get the starting index $tmpIndex = $colIndex; $color = $event->provider->color; if ($event->roomId > 0 && strlen($event->room->color) > 0) { $color = $event->room->color; } if (substr($color, 0, 1) != '#') { $color = '#' . $color; } if (!isset($buildings[$event->buildingId])) { $building = new Building(); $building->buildingId = $event->buildingId; $building->populate(); $buildings[$building->buildingId] = $building; } $columnData[$tmpIndex]['data'][0] = $event->title . ' - ' . $buildings[$event->buildingId]->displayName . $columnData[$tmpIndex]['data'][0]; while ($eventTimeStart < $eventTimeEnd) { $eventDateTimeStart = date('Y-m-d H:i:s', $eventTimeStart); //$eventTimeStart = strtotime('+'.self::FILTER_MINUTES_INTERVAL.' minutes',$eventTimeStart); $eventTimeStart += self::FILTER_MINUTES_INTERVAL * 60; $columnData[$tmpIndex]['style'] = 'background-color:' . $color . ';border-color:lightgrey;'; $columnData[$tmpIndex]['userdata']['title'] = $event->title . ' of ' . $event->provider->optionName . ' (' . $buildings[$event->buildingId]->displayName . ')'; $tmpIndex++; } }
private function ParseBuildingUnit($item) { return Building::FromIDResource(self::ParseIDResource($item)); }
public function deleteBuilding($id) { $building = Building::find($id); $building->delete(); return Redirect::to('buildings')->with('message', 'Building deleted'); }
/** * function for send ajax request to view * * @return Response */ public function listing_ajax() { //$query = Building::all(); $query = Building::select('id', 'title', 'type', 'building_size', 'area_size', 'price', 'status_id', 'created_at')->with('status')->get(); //var_dump($query); return Datatable::collection($query)->addColumn('title', function ($model) { return $model->title; })->addColumn('type', function ($model) { return $model->type; })->addColumn('building_size', function ($model) { return $model->building_size; })->addColumn('area_size', function ($model) { return $model->area_size; })->addColumn('price', function ($model) { return $model->price; })->addColumn('status_id', function ($model) { return $model->status->name; })->addColumn('created_at', function ($model) { return $model->created_at->format('d-m-Y'); })->addColumn('show', function ($model) { return '<a href="' . action('AdminBuildingsController@detail', $model->id) . '" class="btn btn-small btn-primary btn-constant"><i class="fa fa-eye fa-fw"></i></a>'; })->addColumn('edit', function ($model) { return '<a href="' . action('AdminBuildingsController@edit', $model->id) . '" class="btn btn-small btn-success btn-constant"><i class="fa fa-edit fa-fw"></i></a>'; })->addColumn('delete', function ($model) { return '<form action="' . action('AdminBuildingsController@delete', $model->id) . '" method="POST"><button type="submit" class="btn btn-small btn-danger btn-constant" onclick = "return confirm(\'Are you sure?\')"><i class="fa fa-times fa-fw"></i></button></form>'; })->searchColumns('type', 'price', 'status_id')->orderColumns('id', 'type', 'created_at', 'building_size', 'status_id')->make(); }
protected function generateRegistry(SimpleXMLElement $xml) { $registry = $xml->addChild('registry'); $user = new User(); $user->personId = (int) $this->provider->personId; $user->populateWithPersonId(); $building = new Building(); $building->buildingId = $user->defaultBuildingId; $building->populate(); $practice = $building->practice; /* XML Element: <registry-name> * Description: The registry name. * Data Element: Registry Name * Valid Values: Registry Name * Data Type: char(100) * Required: yes */ $registry->addChild('registry-name', $practice->name); /* XML Element: <registry-id> * Description: Used to identify the registry. Use Registry's Corporate TIN number. * Data Element: Registry ID * Data Type: char(9) * Required: yes */ $registry->addChild('registry-id', $practice->identifier); /* XML Element: <submission-method> * Description: Submission Method: (A-F) * A = 12 months, 80%, 3 or more measures * B = 6 months, 80%, 3 or more measures * C = 12 months, 30 consecutive, measure group * E = 12 months, 80%, measure group * F = 6 months, 80%, measure group * 2010 * A = 12 months, 80%, 3 or more measures * B = 6 months, 80%, 3 or more measures * G = 12 months, 30 patients, measure group * H = 12 months, 80%, min. of 15 patients, measure group * I = 6 months, 80%, min. of 8 patients, measure group * Note: Limit one xml file to a single submission method * Data Element: Submission Method * Valid Values: A,B,C,E,F * (12 month reporting period = January 1, 2009 through December 31, 2009; 6 month reporting period = July 1, 2009 through December 31, 2009) * 2010 * A,B,G,H,I * (12 month reporting period = January 1, 2010 through December 31, 2010; 6 month reporting period = July 1, 2010 through December 31, 2010) * Data Type: char(1) * Required: yes */ $registry->addChild('submission-method', 'A'); return $registry; }
public function populateEncounters(SimpleXMLElement $xml) { $component = $xml->addChild('component'); $section = $component->addChild('section'); $templateId = $section->addChild('templateId'); $templateId->addAttribute('root', '2.16.840.1.113883.10.20.1.3'); // <!-- Encounters section template --> $code = $section->addChild('code'); $code->addAttribute('code', '46240-8'); $code->addAttribute('codeSystem', '2.16.840.1.113883.6.1'); $section->addChild('title', 'Encounters'); if ($this->visit !== null) { $visitIterator = array($this->visit); } else { $visitIterator = new VisitIterator(); $visitIterator->setFilters(array('patientId' => $this->_patientId)); } $rows = array(); foreach ($visitIterator as $visit) { $building = new Building(); $building->buildingId = $visit->buildingId; $building->populate(); $appointment = new Appointment(); $appointment->appointmentId = $visit->appointmentId; $appointment->populate(); $rows[] = array('encounter' => html_convert_entities($appointment->title), 'location' => html_convert_entities($building->displayName), 'date' => date('M d, Y', strtotime($visit->dateOfTreatment))); } $text = $section->addChild('text'); if ($rows) { $table = $text->addChild('table'); $thead = $table->addChild('thead'); $tr = $thead->addChild('tr'); $tr->addChild('th', 'Encounter'); $tr->addChild('th', 'Location'); $tr->addChild('th', 'Date'); $tbody = $table->addChild('tbody'); foreach ($rows as $row) { $tr = $tbody->addChild('tr'); $tr->addChild('td', $row['encounter']); $tr->addChild('td', $row['location']); $tr->addChild('td', $row['date']); } } }
<p> <a href="index.php?p=admin&buildings&add"><button type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Add Building</button></a> </p> <table class="table table-bordered table-striped table-hover"> <thead> <tr> <th>Name</th> <th>Community</th> <th>Action</th> </tr> </thead> <tbody class="searchable"> <?php foreach (Building::GetAll() as $building) { echo "<tr>"; echo "<td>" . $building->GetChild() . "</td>"; echo "<td>" . $building->GetParent() . "</td>"; echo "<td>"; echo "<a class=\"btn btn-default btn-sm building_delete\" href=\"#confirm_delete\" data-name=\"" . $building->GetChild() . "\" data-toggle=\"modal\" title=\"Delete Building\"><span class=\"glyphicon glyphicon-trash\"></span></a>"; echo "</td>"; echo "</tr>"; } ?> </tbody> </table> <div class="modal fade" id="confirm_delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content">
protected function displaySummary(BuildingBlock $block) { if ($this->getMode('summary') > SiteView::MODE_NONE) { $type = BuildingBlockViewFactory::getViewType($block); switch ($type) { case 'building-block-audio': $summary = Building::_('Audio Content'); break; case 'building-block-video': $summary = Building::_('Video Content'); break; case 'building-block-image': $summary = Building::_('Image Content'); break; case 'building-block-attachment': $summary = Building::_('Attachment'); break; case 'building-block-xhtml': default: $summary = Building::_('Text Content'); break; } $header = new SwatHtmlTag('h4'); $header->setContent($summary); $header->class = 'building-block-admin-summary'; $header->display(); } }
public function actionEditMolUser($table, $action, $id, $value) { switch ($table) { case 'po_name': switch ($action) { case 'add': $po_name = new po_name(); $po_name->po_name = $value; $po_name->po_type_id = $id; if ($po_name->save()) { $result = 'ПО добавлено'; } break; case 'delete': $po_name = po_name::findOne($id); if ($po_name->active == '1') { $po_name->active = '0'; } else { $po_name->active = '1'; } if ($po_name->save()) { $result = 'Статус изменен'; } break; case 'edit': if ($value != '') { $po_name = po_name::findOne($id); $po_name->po_name = $value; if ($po_name->save()) { $result = 'ПО переименовано'; } } else { $result = 'Введите новое наименование!'; } break; } break; case 'po_type': switch ($action) { case 'add': $po_type = new po_type(); $po_type->po_type = $value; if ($po_type->save()) { $result = 'Тип ПО добавлен'; } break; case 'delete': $po_type = po_type::findOne($id); if ($po_type->active == '1') { $po_type->active = '0'; } else { $po_type->active = '1'; } if ($po_type->save()) { $result = 'Статус изменен'; } break; case 'edit': if ($value != '') { $po_type = po_type::findOne($id); $po_type->po_type = $value; if ($po_type->save()) { $result = 'Тип ПО переименован'; } } else { $result = 'Введите новое наименование!'; } break; } break; case 'mol': switch ($action) { case 'add': $mol = new mol(); $mol->value = $value; if ($mol->save()) { $result = 'МОЛ добавлено'; } break; case 'delete': $mol = mol::findOne($id); if ($mol->active == '1') { $mol->active = '0'; } else { $mol->active = '1'; } if ($mol->save()) { $result = 'Статус изменен'; } break; case 'edit': if ($value != '') { $mol = mol::findOne($id); $mol->value = $value; if ($mol->save()) { $result = 'МОЛ переименовано'; } } else { $result = 'Введите новое наименование!'; } break; } break; case 'cpu': switch ($action) { case 'add': $cpu = new cpu(); $cpu->name = $value; if ($cpu->save()) { $result = 'Процессор добавлен'; } break; case 'delete': $cpu = cpu::findOne($id); if ($cpu->active == '1') { $cpu->active = '0'; } else { $cpu->active = '1'; } if ($cpu->save()) { $result = 'Статус изменен'; } break; case 'edit': if ($value != '') { $cpu = cpu::findOne($id); $cpu->name = $value; if ($cpu->save()) { $result = 'Процессор переименован'; } } else { $result = 'Введите новое наименование!'; } break; } break; case 'cartridge_type': switch ($action) { case 'add': $type = new CartridgeType(); $type->type = $value; if ($type->save()) { $result = 'Тип картриджа добавлен'; } break; case 'delete': $type = CartridgeType::find()->where(['type' => $id])->One(); if ($type->delete()) { $result = 'Тип картриджа удален'; } break; case 'edit': if ($value != '') { $type = CartridgeType::find()->where(['type' => $id])->One(); $type->type = $value; if ($type->update()) { $result = 'Картридж переименован'; } } else { $result = 'Введите новое наименование!'; } break; } break; case 'consignment': switch ($action) { case 'add': $consignment = new consignment(); $consignment->name = $value; if ($consignment->save()) { $result = 'Партия добавлена'; } else { $result = 'Партия НЕ добавлена'; } break; case 'delete': // $query_str = 'UPDATE consignment SET active = NOT active WHERE id = "'.$id.'"'; //$consignment = consignment::findOne($id); //if ($consignment -> active == '1') $consignment -> active = '0'; else $consignment -> active = '1'; //$consignment -> save(); //$result = 'Статус изменен'; break; case 'edit': if ($value != '') { $consignment = consignment::findOne($id); $consignment->name = $value; if ($consignment->save()) { $result = 'Партия переименована'; } } else { $result = 'Введите новое наименование!'; } break; } break; case 'type': switch ($action) { case 'add': $device_type = new deviceType(); $device_type->value = $value; if ($device_type->save()) { $result = 'Тип добавлен'; } break; case 'delete': $device_type = deviceType::findOne($id); if ($device_type->active == '1') { $device_type->active = '0'; } else { $device_type->active = '1'; } if ($device_type->save()) { $result = 'Статус изменен'; } break; case 'edit': if ($value != '') { $device_type = deviceType::findOne($id); $device_type->value = $value; if ($device_type->save()) { $result = 'Тип переименован'; } } else { $result = 'Введите новое наименование!'; } break; } break; case 'mark': switch ($action) { case 'add': $mark = new trademarks(); $mark->value = $value; if ($mark->save()) { $result = 'Марка добавлена'; } break; case 'delete': $mark = mark::findOne($id); if ($mark->active == '1') { $mark->active = '0'; } else { $mark->active = '1'; } if ($mark->save()) { $result = 'Статус изменен'; } break; case 'edit': if ($value != '') { $mark = mark::findOne($id); $mark->value = $value; if ($mark->save()) { $result = 'Марка переименована'; } } else { $result = 'Введите новое наименование!'; } break; } break; case 'user': switch ($action) { case 'add': $user = new user(); $user->name = $value; $user->password = sha1('1'); if ($user->save()) { $result = 'Сотрудник добавлен'; } break; case 'delete': if ($value != '') { $user = user::findOne($id); if ($user->active == '1') { $user->active = '0'; } else { $user->active = '1'; } if ($user->save()) { $result = 'Статус изменен'; } } else { $result = 'Введите новое наименование!'; } break; case 'edit': $user = user::findOne($id); $user->name = $value; if ($user->save()) { $result = 'Сотрудник переименован'; } break; } break; case 'room': switch ($action) { case 'add': $room = new room(); $room->value = $value; $room->building_id = $id; if ($room->save()) { $result = 'Кабинет добавлен'; } else { $result = print_r($room->getErrors()); } break; case 'delete': $room = room::findOne($id); if ($room->active == '1') { $room->active = '0'; } else { $room->active = '1'; } $room->save(); //$result = 'Статус изменен'; $result = ''; break; case 'edit': if ($value != '') { $room = room::findOne($id); $room->value = $value; if ($room->save()) { $result = 'Кабинет переименован'; } } else { $result = 'Введите новое наименование!'; } break; } break; case 'device': switch ($action) { case 'add': switch (substr($id, 0, 3)) { case 'mrk': $result = 'Марка не добавлена! Выберите тип устройства для добавления!'; break; case 'typ': $type_id = intval(substr($id, 4)); $trademark = new trademark(); $trademark->value = $value; $TypeLinkMark = new TypeLinkMark(); $TypeLinkMark->type_id = $type_id; $TypeLinkMark->mark_id = Yii::app()->db->getLastInsertID(); if ($TypeLinkMark->save() && $trademark->save()) { $result = 'Марка добавлена'; } break; } break; case 'delete': $device = new device(); $device->value = $value; if ($device->save()) { $result = 'Статус изменен'; } break; case 'edit': $query_str = 'UPDATE user SET value = "' . $value . '" WHERE id = "' . $id . '"'; $result = 'Сотрудник переименован'; break; } break; case 'model': switch ($action) { case 'add': $model = new model(); $model->value = $value; $model->save(); $result = 'Модель добавлена'; break; case 'delete': $model = model::findOne($id); if ($model->active == '1') { $model->active = '0'; } else { $model->active = '1'; } $model->save(); //$result = 'Статус изменен'; $result = ''; break; case 'edit': if ($value != '') { $model = model::findOne($id); $model->value = $value; if ($model->save()) { $result = 'Модель переименована'; } } else { $result = 'Введите новое наименование!'; } break; } break; case 'department': switch ($action) { case 'delete': //$result = 'Статус изменен'; $department = department::findOne($id); if ($department->active == '1') { $department->active = '0'; } else { $department->active = '1'; } $department->save(); $result = ''; break; case 'edit': if ($value != '') { $department = department::findOne($id); $department->value = $value; if ($department->save()) { $result = 'Подразделение переименовано'; } } else { $result = 'Введите новое наименование!'; } break; case 'add': $department = new Department(); $department->value = $value; if ($department->save()) { $result = 'Подразделение добавлено'; } break; } break; case 'building': switch ($action) { case 'delete': $building = building::findOne($id); if ($building->active == '1') { $building->active = '0'; } else { $building->active = '1'; } $building->save(); //$result = 'Статус изменен'; $result = ''; break; case 'edit': if ($value != '') { $building = building::findOne($id); $building->value = $value; if ($building->save()) { $result = 'Здание переименовано'; } } else { $result = 'Введите новое наименование!'; } break; case 'add': $building = new Building(); $building->value = $value; $building->department_id = $id; if ($building->save()) { $result = 'Здание добавлено'; } break; } break; } echo $result; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Building::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }
// {{{ public static function setupGettext() public static function setupGettext() { $path = '@DATA-DIR@/Building/locale'; if (substr($path, 0, 1) === '@') { $path = __DIR__ . '/../locale'; } bindtextdomain(self::GETTEXT_DOMAIN, $path); bind_textdomain_codeset(self::GETTEXT_DOMAIN, 'UTF-8'); } // }}} // {{{ private function __construct() /** * Don't allow instantiation of the Building object * * This class contains only static methods and should not be instantiated. */ private function __construct() { } } Building::setupGettext(); SiteViewFactory::addPath('Building/views'); SiteViewFactory::registerView('building-block-audio', 'BuildingBlockAudioView'); SiteViewFactory::registerView('building-block-video', 'BuildingBlockVideoView'); SiteViewFactory::registerView('building-block-image', 'BuildingBlockImageView'); SiteViewFactory::registerView('building-block-xhtml', 'BuildingBlockXHTMLView'); SiteViewFactory::registerView('building-block-attachment', 'BuildingBlockAttachmentView'); SiteViewFactory::registerView('building-block', 'BuildingBlockCompositeView'); SiteViewFactory::registerView('building-block-admin', 'BuildingBlockAdminCompositeView'); SwatUI::mapClassPrefixToPath('Building', 'Building');
/** * Saves buildings. First all will be deleted and then the new or earlier existing ones will * be added again. This prevents a need for comparison. */ public function actionBuildingSave($kohteetString, $imageid, $cd, $id, $addTo = false) { // if we are not adding to the previous values, but instead are replacing if (!$addTo) { // clearing out all the 'kohteet' for the image Building::model()->deleteByPk($imageid); } // getting rid of spaces in the inputstring $kohteetString = str_replace(' ', '', $kohteetString); // splits the inputted string into an array, so each building can be handled on it's own $kohteetArray = explode(',', $kohteetString); // this repeated for the kohteetArray, so that every building is it's own row in the kohteet table foreach ($kohteetArray as $kohde) { $saari = preg_replace('/[0-9k-z]/', '', $kohde); $rakennus = preg_replace('/[^0-9k-z]/', '', $kohde); // converting saari letter to uppercase $saari = strtolower($saari); if (strlen($saari) < 1) { continue; } // if we are adding, checks the database if the building&image combination is already there, will not add a duplicate if ($addTo) { $duplicateCriteria = new CDbCriteria(); $duplicateCriteria->condition = 'cdno=:cdno'; $duplicateCriteria->addCondition('idno=:idno'); $duplicateCriteria->addCondition('saari=:saari'); $duplicateCriteria->addCondition('rakennus=:rakennus'); $duplicateCriteria->params = array(':cdno' => $cd, ':idno' => $id, ':saari' => $saari, ':rakennus' => $rakennus); // if a it's already found in the database, will continue; to the the next kohde if (Building::model()->find($duplicateCriteria)) { continue; } } $newKohde = new Building(); $newKohde->cdno = $cd; $newKohde->idno = $id; $newKohde->saari = $saari; $newKohde->rakennus = $rakennus; $newKohde->fk = $imageid; $newKohde->save(); unset($newKohde); } }
require_once '../lib/place.lib.php'; // Load traductions files requiredby by page $langs->load("place@place"); $langs->load("companies"); $langs->load("other"); // Get parameters $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $fk_place = GETPOST('fk_place', 'int'); $ref = GETPOST('ref', 'alpha'); $lat = GETPOST('lat', 'alpha'); $lng = GETPOST('lng', 'alpha'); if (!$user->rights->place->read) { accessforbidden(); } $object = new Building($db); /******************************************************************* * ACTIONS * * Put here all code to do according to value of "action" parameter ********************************************************************/ if ($action == 'update' && !$_POST["cancel"] && $user->rights->place->write) { $error = 0; if (empty($ref)) { $error++; $mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")) . '</div>'; } if (!$error) { $object->fetch($id); $object->ref = $ref; $object->lat = $lat;