public function loadXML($xml) { $dom = new \SimpleXMLElement($xml); if (!isset($dom->tokenXPath) || count($dom->tokenXPath) != 1) { throw new \LengthException('exactly one tokenXPath has to be provided'); } $this->tokenXPath = $dom->tokenXPath; if (!isset($dom->tokenValueXPath) || count($dom->tokenValueXPath) != 1) { throw new \LengthException('exactly one tokenValueXPath has to be provided'); } $this->tokenValueXPath = $dom->tokenValueXPath; if (!isset($dom->properties) || !isset($dom->properties->property) || count($dom->properties->property) == 0) { throw new \LengthException('no token properties defined'); } $n = 1; $names = array(); foreach ($dom->properties->property as $i) { $prop = new Property($i, $n++); $this->properties[] = $prop; $names[] = $prop->getName(); } if (count($names) !== count(array_unique($names))) { throw new \RuntimeException('property names are not unique'); } if (isset($dom->namespaces) && isset($dom->namespaces->namespace)) { foreach ($dom->namespaces->namespace as $i) { $this->namespaces[(string) $i->prefix[0]] = (string) $i->uri[0]; } } }
public function doNode(\SimpleXMLElement $node) { $this->id = trim((string) $node['id']); if ($this->id == '') { throw new IocException("A bean without id has been found !"); } $this->className = trim((string) $node['class']); if ($this->className == '') { throw new IocException("Bean ({$this->id}) must have a class attribute"); } $this->scope = trim((string) $node['scope']); if ($this->scope == '') { $this->scope = self::SCOPE_SINGLETON; } foreach ($node->property as $property) { $prop = new Property(); $prop->doNode($property); $this->properties[] = $prop; } $this->initMethod = trim((string) $node['init-method']); $lazyInit = trim((string) $node['lazy-init']); if ($lazyInit == 'false') { $this->lazyInit = false; } $this->exported = trim((string) $node['export']); }
private function init() { $this->url = $_SERVER['SCRIPT_NAME'] . "?tab=" . $_GET['tab'] . "&pluginID=" . $_GET['pluginID']; include_once 'classes/Property.php'; $property = new Property(); if ($this->rrdtool = $property->get_property("path_rrdtool")) { } else { print $property->get_error(); exit; } if ($this->rrd_dir = $property->get_property("path_rrddir")) { } else { print $property->get_error(); exit; } if (!$this->rrdtool || $this->rrdtool == '') { print "Could not find rrdtool"; exit; } if (!$this->rrd_dir || $this->rrd_dir == '') { print "Could not find rrd_dir"; exit; } return; }
public function addProperty(Property $property) { if ($property->getVarName()) { $this->properties[$property->getVarName()] = $property; } return $this; }
public function prepareObjectAttributes($record) { $property = array(); foreach ($record->metas as $meta) { // // NEED TO REFACTORED // $prop_attr['key_name'] = $meta->meta->key_name; $prop_attr['value'] = $meta->meta_value; $prop_attr['descr'] = $meta->meta->descr; $prop_attr['id'] = $meta->id; // // ==== $prop = new Property(); $prop->setAttributes($prop_attr); $property[] = $prop->getAttributes(); } $objects = array(); foreach ($record->objects as $object) { $objects[] = array('name' => $object->name, 'text_value' => $object->text_value, 'descr' => $object->descr, 'id' => $object->id); } $attr = $record->getAttributes(); $attr['type'] = $record->type->name; $attr['property'] = $property; $attr['objects'] = $objects; return $attr; }
public function test_destroying_should_cascade() { $Property = new Property(array('description' => 'This is a Property')); $Picture = $Property->picture->create(array('title' => 'Front')); $Property->destroy(); $this->assertFalse($this->Property->find('first', array('default' => false))); $this->assertFalse($this->Picture->find('first', array('default' => false))); }
public function testNoModifiers() { $node = new Property(0, array()); $this->assertTrue($node->isPublic()); $this->assertFalse($node->isProtected()); $this->assertFalse($node->isPrivate()); $this->assertFalse($node->isStatic()); }
public function testStaticImplicitlyPublic() { $node = new Property(Class_::MODIFIER_STATIC, array()); $this->assertTrue($node->isPublic()); $this->assertFalse($node->isProtected()); $this->assertFalse($node->isPrivate()); $this->assertTrue($node->isStatic()); }
/** * __construct() should set the names and message if $names is a string */ public function test___construct_returnsSelf_ifNamesIsString() { $name = 'foo'; $e = new Property($name); $this->assertEquals([$name], $e->getNames()); $this->assertEquals("Property {$name} could not be found", $e->getMessage()); return; }
/** * Shorthand to create or update properties * * @return void * @author Carlos Escribano <*****@*****.**> **/ public static function set($key, $value) { if (!($p = Doctrine::getTable('Property')->findOneBy('keey', $key))) { $p = new Property(); $p->setKeey($key); } $p->setValue($value); $p->save(); }
/** * Adds a Property. If Property already exists an Exception will be thrown. * * @param Property $property * * @return $this * * @throws \Exception */ public function add(Property $property) { // Property already exists? if (null !== $this->get($property->getName())) { throw new \Exception("Property with name '{$property->getName()}' already exists"); } $this->elements[] = $property; return $this; }
/** * Creates a new Property model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Property(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->property_id]); } else { return $this->render('create', ['model' => $model]); } }
/** * @param Property $property */ public function add(Property $property) { $propertyName = $property->getName(); if (isset($this->properties[$propertyName])) { $existantProperty = $this->properties[$propertyName]; $this->properties[$propertyName] = $existantProperty->merge($property); } else { $this->properties[$propertyName] = $property; } }
/** * @test */ function it_returns_value_read_with_property_accessor() { $property = 'property'; $data = array('some data'); $propertyValue = 'property value'; $this->accessor->expects($this->once())->method('getValue')->with($data, $property)->willReturn($propertyValue); $filter = new Property($this->accessor); $filter->setProperty($property); $this->assertSame($propertyValue, $filter->filter($data)); }
public function __construct(Property $property, User $user, $action) { $this->user = $user; $this->property = $property; $this->name = $property->getName(); $this->datatype = $property->getDatatype(); $this->description = $property->getDescription(); $this->descr = $property->getDescr(); $this->action = $action; $this->action_time = new \DateTime(); }
public function compareValue(Property $a, Property $b) { // FIXME: unicode compare and take LANGUAGE into account. if ($a->getValue() == $b->getValue()) { return 0; } elseif ($a->getValue() < $b->getValue()) { return -1; } else { return 1; } }
private function createProperties() { $propertiesList = $this->document->getElementsByTagName('property'); foreach ($propertiesList as $property) { $obj = new Property(); $name = $property->getAttribute("name"); $value = $property->getAttribute("value"); $obj->setName($name); $obj->setValue($value); $this->addProperty($name, $obj); } }
function update_config($values = '') { //calls on for the database class include_once "classes/Property.php"; $property = new Property(); //sets the properties to store them, use a switch statement to store different description based on different properties if ($property->set_property("Plugin_HelloWorld_greetings", $_POST['Plugin_HelloWorld_greetings'], "Hello World description")) { return true; } else { return false; } }
public function setAttributes($attr) { parent::setAttributes($attr); $props = $attr['property']; if (isset($props) && is_array($props)) { foreach ($props as $propertyAttr) { $property = new Property(); $property->setAttributes($propertyAttr); $this->property[] = $property; } } }
/** * @param Property $property */ public function merge(Property $property) { $value = $property->getValue(); if ($this->isCollection()) { if (!is_array($value)) { $value = [$value]; } $this->value = array_merge($this->value, $value); } else { $this->value = $value; } return $this; }
function showPropiedad($id) { $pictures = DB::table('pictures')->where('property_id', $id)->get(); $property = Property::find($id); if (!$property) { return Redirect::to("/"); } switch ($property->type) { case "Casas": $options = array("plural" => "Casas", "singular" => "Casa", 'icon' => 'home', 'color' => '#32A20E'); break; case "Terrenos": $options = array("plural" => "Terrenos", "singular" => "Terreno", 'icon' => 'tree-deciduous', 'color' => '#32A20E'); break; case "Locales": $options = array("plural" => "Locales", "singular" => "Local", 'icon' => 'gift', 'color' => '#FF0444'); break; default: $options = array("plural" => "Terrenos", "singular" => "Terreno", 'icon' => 'tree-deciduous', 'color' => '#32A20E'); } if ($property->oportunidad) { $options = array("plural" => "Oportunidades", "singular" => "Oportunidad", 'icon' => 'usd', 'color' => '#32A20E'); } return View::make('property_show', array('property' => $property, 'pictures' => $pictures, 'options' => $options)); }
public static function get_instance() { if (self::$property == NULL) { self::$property = new Property(); } return self::$property; }
/** * Short description of method toArray * * @access public * @author Joel Bout, <*****@*****.**> * @return array */ public function toArray() { $returnValue = array(); $returnValue = parent::toArray(); $returnValue['prop'] = $this->property->getUri(); return (array) $returnValue; }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Property::create([]); } }
/** * Display the specified resource. * GET /accountreceivables/{id} * * @param int $id * @return Response */ public function show($id) { $invoices = Invoice::with('invoicedetail')->find($id); if ($invoices->type === "to tenant") { $total = $invoices->invoicedetail->rent + $invoices->invoicedetail->water + $invoices->invoicedetail->electricity + $invoices->invoicedetail->security + $invoices->invoicedetail->service + $invoices->invoicedetail->garbage; } elseif ($invoices->type === "refund") { $total = $invoices->invoicedetail->rentD + $invoices->invoicedetail->waterD + $invoices->invoicedetail->electricityD + $invoices->invoicedetail->g_repairs + $invoices->invoicedetail->transport_cost + $invoices->invoicedetail->o_bills + $invoices->invoicedetail->storage_fees + $invoices->invoicedetail->fixed_unit; } elseif ($invoices->type === "deposits") { $total = $invoices->invoicedetail->rentD + $invoices->invoicedetail->waterD + $invoices->invoicedetail->electricityD + $invoices->invoicedetail->g_repairs + $invoices->invoicedetail->transport_cost + $invoices->invoicedetail->o_bills + $invoices->invoicedetail->storage_fees + $invoices->invoicedetail->fixed_unit + $invoices->invoicedetail->rent; } $houseid = $invoices->id; $hid = $invoices->houseID; $housename = House::where('id', $hid)->pluck('name'); $propertyid = House::where('id', $hid)->pluck('propertyID'); $propertyname = Property::where('id', $propertyid)->pluck('name'); $allbal = Invoice::where('houseID', $hid)->sum('balance'); if ($invoices->amountpaid <= 0) { $outstandingbal = $allbal; } else { $outstandingbal = $allbal - $invoices->balance; } $balance = $invoices->balance; if ($outstandingbal == $invoices->balance) { $amountdue = $invoices->balance; } else { $amountdue = $invoices->balance + $outstandingbal; } $title = "Print Invoice"; return View::make('backend.code.invoice.show', compact('invoices', 'housename', 'title', 'outstandingbal', 'propertyname', 'invoicedetails', 'total', 'balance', 'amountdue')); }
/** * Display the specified resource. * GET /accountreceivables/{id} * * @param int $id * @return Response */ public function show($id) { $housedues = Housedue::findOrFail($id); $houseduepid = $housedues->propertyID; $propetyName = Property::where('id', $houseduepid)->pluck('name'); return View::make('backend.code.housedue.show', compact('housedues', 'propetyName')); }
private function saveAndDeleteMedia($type) { /** @var $model Media [ ] */ $model = new Media(); $mockRecord = $this->getMockRecord(); $instruction = Deal::model()->findByPk($mockRecord['med_row']); $this->assertNotEmpty($instruction, "instruction not exist"); $property = Property::model()->findByPk($instruction->dea_prop); $this->assertNotEmpty($property, "property not exist"); $this->assertNotNull($property->addressId, "property has no address"); $address = Address::model()->findByPk($property->addressId); $this->assertNotEmpty($address, " Address not exist"); $model->setAttributes($this->getMockRecord()); $model->file = $this->getMockCuploadedImage('image/jpeg', 1); if ($type == Media::TYPE_PHOTO) { $model->setCropFactor($this->getCropFactor()); } elseif ($type == Media::TYPE_EPC || $type == Media::TYPE_FLOORPLAN) { $model->otherMedia = $type; } $this->assertTrue($model->validate(), "record not validated"); $this->assertTrue($model->save(), "record not saved"); foreach ($model->getImageSizes() as $imageSize) { $this->assertFileExists($model->getFullPath($imageSize), $imageSize . " does not exist"); } $this->deleteMedia($model->med_id); }
function filtered_search_by_mixed_criteria_csv(&$output_data, &$xslt_file = "") { $recordsearcher = new RecordSearcher(); //echo microtime()."RecordIniFacade: filtered_search_by_mixed_criteria; before executing ".'$recordsearcher->filtered_search_by_mixed_criteria();'." <br>"; $eids = $recordsearcher->filtered_search_by_mixed_criteria(false); $_REQUEST['eids'] = $eids; if (!isset($_REQUEST['type_id'])) { $_REQUEST['type_id'] = $_SESSION['type_id']; } //$this->initializeRecordSet($xml_string, $xslt_file); //initialize MyEDB_Matrix with prop ids to be column names //get Property::get_property_list $property_list = Property::get_property_list(); //print_r($property_list); echo "helloo"; $myedb_matrix = new MyEDB_Matrix($property_list); //do loop through eids creating associative array of resulting recs foreach ($eids as $eid) { $type_id = RecordsSys_EntityManagementSystems::get_type_id($eid); //can't rely on request type_id, because search results may have generic type_id $one_row_rec = new One_Row_Record($eid, $type_id); $one_row_rec->exclude_properties = array(26, 27); $one_row_rec->setup(); //add $one_row_rec to MyEDB_Matrix $myedb_matrix->add_one_row_record($one_row_rec); //add $complete_prop_matrix to $eid_recs } $myedb_matrix->finalize_matrix(); $output_data = $myedb_matrix->get_matrix(); }
public function index(SS_HTTPRequest $request) { $properties = Property::get(); if ($search = $request->getVar('Keywords')) { $properties = $properties->filter(array('Title:PartialMatch' => $search)); } if ($arrival = $request->getVar('ArrivalDate')) { $arrivalStamp = strtotime($arrival); $nightAdder = '+' . $request->getVar('Nights') . ' days'; $startDate = date('Y-m-d', $arrivalStamp); $endDate = date('Y-m-d', strtotime($nightAdder, $arrivalStamp)); $properties = $properties->filter(array('AvailableStart:LessThanOrEqual' => $startDate, 'AvailableEnd:GreaterThanOrEqual' => $endDate)); } if ($bedrooms = $request->getVar('Bedrooms')) { $properties = $properties->filter(array('Bedrooms:GreaterThanOrEqual' => $bedrooms)); } if ($bathrooms = $request->getVar('Bathrooms')) { $properties = $properties->filter(array('Bathrooms:GreaterThanOrEqual' => $bathrooms)); } if ($minPrice = $request->getVar('MinPrice')) { $properties = $properties->filter(array('PricePerNight:GreaterThanOrEqual' => $minPrice)); } if ($maxPrice = $request->getVar('MaxPrice')) { $properties = $properties->filter(array('PricePerNight:LessThanOrEqual' => $maxPrice)); } $paginatedProperties = PaginatedList::create($properties, $request)->setPageLength(15)->setPaginationGetVar('s'); $data = array('Results' => $paginatedProperties); if ($request->isAjax()) { return $this->customise($data)->renderWith('PropertySearchResults'); } return $data; }
public function index(SS_HTTPRequest $request) { $properties = Property::get(); $filters = ArrayList::create(); if ($search = $request->getVar('Keywords')) { $filters->push(ArrayData::create(array('Label' => "Keywords: '{$search}'", 'RemoveLink' => HTTP::setGetVar('Keywords', null)))); $properties = $properties->filter(array('Title:PartialMatch' => $search)); } if ($arrival = $request->getVar('ArrivalDate')) { $arrivalStamp = strtotime($arrival); $nightAdder = '+' . $request->getVar('Nights') . ' days'; $startDate = date('Y-m-d', $arrivalStamp); $endDate = date('Y-m-d', strtotime($nightAdder, $arrivalStamp)); $properties = $properties->filter(array('AvailableStart:GreaterThanOrEqual' => $startDate, 'AvailableEnd:LessThanOrEqual' => $endDate)); } if ($bedrooms = $request->getVar('Bedrooms')) { $filters->push(ArrayData::create(array('Label' => "{$bedrooms} bedrooms", 'RemoveLink' => HTTP::setGetVar('Bedrooms', null)))); $properties = $properties->filter(array('Bedrooms:GreaterThanOrEqual' => $bedrooms)); } if ($bathrooms = $request->getVar('Bathrooms')) { $filters->push(ArrayData::create(array('Label' => "{$bathrooms} bathrooms", 'RemoveLink' => HTTP::setGetVar('Bathrooms', null)))); $properties = $properties->filter(array('Bathrooms:GreaterThanOrEqual' => $bathrooms)); } if ($minPrice = $request->getVar('MinPrice')) { $filters->push(ArrayData::create(array('Label' => "Min. \${$minPrice}", 'RemoveLink' => HTTP::setGetVar('MinPrice', null)))); $properties = $properties->filter(array('PricePerNight:GreaterThanOrEqual' => $minPrice)); } if ($maxPrice = $request->getVar('MaxPrice')) { $filters->push(ArrayData::create(array('Label' => "Max. \${$maxPrice}", 'RemoveLink' => HTTP::setGetVar('MaxPrice', null)))); $properties = $properties->filter(array('PricePerNight:LessThanOrEqual' => $maxPrice)); } $paginatedProperties = PaginatedList::create($properties, $request)->setPageLength(15)->setPaginationGetVar('s'); return array('Results' => $paginatedProperties, 'ActiveFilters' => $filters); }