public function __construct($width, $height, $guid_embed_redline)
 {
     $this->width = $width;
     $this->height = $height;
     $this->guid_embed_redline = $guid_embed_redline;
     parent::__construct();
 }
 /**
  * Instantiate a new customised ViewableData object
  *
  * @param ViewableData $originalObject
  * @param ViewableData $customisedObject
  */
 public function __construct(ViewableData $originalObject, ViewableData $customisedObject)
 {
     $this->original = $originalObject;
     $this->customised = $customisedObject;
     $this->original->setCustomisedObj($this);
     parent::__construct();
 }
Ejemplo n.º 3
0
 function __construct($name)
 {
     parent::__construct();
     if (preg_match('/^(\\w+)$/i', $name, $match)) {
         $this->Name = $match[1];
     }
 }
Ejemplo n.º 4
0
 public function __construct($fragment = null)
 {
     if ($fragment) {
         $this->setContent($fragment);
     }
     parent::__construct();
 }
 public function __construct($width, $height, $url)
 {
     $this->width = $width;
     $this->height = $height;
     $this->server_url = $url;
     parent::__construct();
 }
 /**
  * Creates a new restful service.
  * @param string $base Base URL of the web service eg: api.example.com
  * @param int $expiry Set the cache expiry interva. Defaults to 1 hour (3600 seconds)
  */
 public function __construct($base, $expiry = 3600)
 {
     $this->baseURL = $base;
     $this->cache_expire = $expiry;
     parent::__construct();
     $this->proxy = $this->config()->default_proxy;
 }
 /**
  * @param string $content
  */
 public function __construct($content = null)
 {
     $this->document = new DOMDocument('1.0', 'UTF-8');
     $this->document->scrictErrorChecking = false;
     $this->setContent($content);
     parent::__construct();
 }
 /**
  * Creates a new restful service.
  * @param string $base Base URL of the web service eg: api.example.com 
  * @param int $expiry Set the cache expiry interva. Defaults to 1 hour (3600 seconds)
  */
 function __construct($base, $expiry = 3600)
 {
     $this->baseURL = $base;
     $this->cache_expire = $expiry;
     $this->proxy = self::$default_proxy;
     parent::__construct();
 }
Ejemplo n.º 9
0
 /**
  * Construct a new DataObject.
  *
  * @param array|null $record This will be null for a new database record.  Alternatively, you can pass an array of
  * field values.  Normally this contructor is only used by the internal systems that get objects from the database.
  * @param boolean $isSingleton This this to true if this is a singleton() object, a stub for calling methods.  Singletons
  * don't have their defaults set.
  */
 function __construct($record = null, $isSingleton = false)
 {
     // Set the fields data.
     if (!$record) {
         $record = array("ID" => 0);
     }
     if (!is_array($record)) {
         if (is_object($record)) {
             $passed = "an object of type '{$record->class}'";
         } else {
             $passed = "The value '{$record}'";
         }
         user_error("DataObject::__construct passed {$passed}.  It's supposed to be passed an array,\n\t\t\t\ttaken straight from the database.  Perhaps you should use DataObject::get_one instead?", E_USER_WARNING);
         $record = null;
     }
     $this->record = $this->original = $record;
     // Keep track of the modification date of all the data sourced to make this page
     // From this we create a Last-Modified HTTP header
     if (isset($record['LastEdited'])) {
         HTTP::register_modification_date($record['LastEdited']);
     }
     parent::__construct();
     // Must be called after parent constructor
     if (!$isSingleton && (!isset($this->record['ID']) || !$this->record['ID'])) {
         $this->populateDefaults();
     }
     // prevent populateDefaults() and setField() from marking overwritten defaults as changed
     $this->changed = array();
 }
 public function __construct($name, $dataSource)
 {
     $this->name = $name;
     $this->realisedName = $name;
     $this->dataSource = $dataSource;
     parent::__construct();
 }
 public function __construct($width, $height, $guid)
 {
     $this->width = $width;
     $this->height = $height;
     $this->guid = $guid;
     parent::__construct();
 }
Ejemplo n.º 12
0
 /**
  * Constructor
  * 
  * @deprecated 3.1 Use DataList to aggregate data
  * 
  * @param string $type The DataObject type we are building an aggregate for
  * @param string $filter (optional) An SQL filter to apply to the selected rows before calculating the aggregate
  */
 public function __construct($type, $filter = '')
 {
     Deprecation::notice('3.1', 'Call aggregate methods on a DataList directly instead. In templates' . ' an example of the new syntax is &lt% cached List(Member).max(LastEdited) %&gt instead' . ' (check partial-caching.md documentation for more details.)');
     $this->type = $type;
     $this->filter = $filter;
     parent::__construct();
 }
 /**
  * Creates a new restful service.
  * @param string $base Base URL of the web service eg: api.example.com 
  * @param int $expiry Set the cache expiry interva. Defaults to 1 hour (3600 seconds)
  * @param int $timeout (Defaults to 5 s)
  */
 function __construct($base, $expiry = 3600, $timeout = 5)
 {
     $this->baseURL = $base;
     $this->cache_expire = $expiry;
     $this->timeoutRequest = $timeout;
     $this->proxy = self::$default_proxy;
     parent::__construct();
 }
Ejemplo n.º 14
0
 /**
  * Construct a DataDifferencer to show the changes between $fromRecord and $toRecord.
  * If $fromRecord is null, this will represent a "creation".
  * 
  * @param DataObject (Optional)
  * @param DataObject 
  */
 function __construct($fromRecord, DataObject $toRecord)
 {
     if (!$toRecord) {
         user_error("DataDifferencer constructed without a toRecord", E_USER_WARNING);
     }
     $this->fromRecord = $fromRecord;
     $this->toRecord = $toRecord;
     parent::__construct();
 }
 public function __construct()
 {
     $this->brokenOnConstruct = false;
     // Check necessary to avoid class conflicts before manifest is rebuilt
     if (class_exists('NullHTTPRequest')) {
         $this->request = new NullHTTPRequest();
     }
     parent::__construct();
 }
 public function __construct()
 {
     parent::__construct();
     $this->init();
     foreach ($this->getClasses() as $class => $options) {
         SearchVariant::with($class, $options['include_children'])->call('alterDefinition', $class, $this);
     }
     $this->buildDependancyList();
 }
 public function __construct($data = array())
 {
     parent::__construct();
     if (is_array($data)) {
         foreach ($data as $k => $v) {
             $this->{$k} = $v;
         }
     }
 }
Ejemplo n.º 18
0
 function __construct($id)
 {
     parent::__construct();
     if (preg_match('/^(\\w+)\\.(\\w+)$/i', $id, $match)) {
         $this->Table = $match[1];
         $this->Label = $match[2];
     } else {
         $this->Label = $id;
     }
 }
 /**
  * sets up the object
  * @param object|array $srcdata
  */
 function __construct($src = false)
 {
     if (is_object($src)) {
         $src->class = get_class($src);
         $this->failover = $src;
     } elseif (is_array($src)) {
         $this->failover = new ArrayData($src);
     }
     parent::__construct();
 }
 /**
  * @param object|array $array Either an object with simple properties or an associative array.
  * Converts object-properties to indices of an associative array.
  */
 public function __construct($array)
 {
     if (is_object($array)) {
         $this->array = self::object_to_array($array);
     } elseif (is_array($array) && (ArrayLib::is_associative($array) || count($array) === 0)) {
         $this->array = $array;
     } else {
         $this->array = $array;
         user_error("ArrayData::__construct: Parameter needs to be an object or associative array", E_USER_WARNING);
     }
     parent::__construct();
 }
Ejemplo n.º 21
0
 /**
  * Create a new field.
  * @param name The internal field name, passed to forms.
  * @param title The field label.
  * @param value The value of the field.
  * @param form Reference to the container form
  * @param maxLength The Maximum length of the attribute
  */
 function __construct($name, $title = null, $value = null, $form = null, $rightTitle = null)
 {
     $this->name = $name;
     $this->title = $title === null ? $name : $title;
     if (isset($value)) {
         $this->value = $value;
     }
     if ($form) {
         $this->setForm($form);
     }
     parent::__construct();
 }
 public function __construct($content, $type = null, $title = null, $timeOut = null, $extendedTimeOut = null)
 {
     parent::__construct();
     $this->Title = $title;
     if (is_bool($type) || is_numeric($type)) {
         $this->Type = $type ? StatusMessageTypes::SUCCESS : StatusMessageTypes::DANGER;
     } else {
         $this->Type = is_null($type) ? StatusMessageTypes::INFO : $type;
     }
     $this->Content = $content;
     $this->TimeOut = $timeOut;
     $this->ExtendedTimeOut = $extendedTimeOut;
 }
Ejemplo n.º 23
0
 public function __construct($environmentDir = null, $keyDir = null, $dataTransferDir = null, $gitUser = null)
 {
     parent::__construct();
     // Better to use injector to set these
     if (func_num_args() == 0) {
         return;
     }
     Deprecation::notice('1.2.0', "Don't construct DNData with parameters. Assign settings via properties instead");
     $this->setEnvironmentDir($environmentDir);
     $this->setKeyDir($keyDir);
     $this->setDataTransferDir($dataTransferDir);
     $this->setGitUser($gitUser);
 }
Ejemplo n.º 24
0
 /**
  * @param object|array $value An associative array, or an object with simple properties.
  * Converts object properties to keys of an associative array.
  */
 public function __construct($value)
 {
     if (is_object($value)) {
         $this->array = get_object_vars($value);
     } elseif (ArrayLib::is_associative($value)) {
         $this->array = $value;
     } elseif (is_array($value) && count($value) === 0) {
         $this->array = array();
     } else {
         $message = 'Parameter to ArrayData constructor needs to be an object or associative array';
         throw new InvalidArgumentException($message);
     }
     parent::__construct();
 }
 function __construct($relativePath, $entity, $lang = null, $version = null)
 {
     $this->entity = $entity;
     $this->relativePath = $relativePath;
     if ($lang) {
         $this->lang = $lang;
     }
     if ($version) {
         $this->version = $version;
     }
     if (!file_exists($this->getPath())) {
         throw new InvalidArgumentException(sprintf('Path could not be found. Module path: %s, file path: %s', $this->entity->getPath(), $this->relativePath));
     }
     parent::__construct();
 }
Ejemplo n.º 26
0
 function __construct($id = null)
 {
     parent::__construct();
     if (preg_match('/^(\\w+)\\.(\\d+)$/i', $id, $match)) {
         $this->table = $match[1];
         $this->id = $match[2];
         $this->data = DB::query('SELECT * FROM "' . $match[1] . '" WHERE "ID" = \'' . $this->id . '\'')->first();
     } else {
         if (preg_match('/^(\\w+)$/i', $id, $match)) {
             $this->table = $match[1];
             foreach (DB::fieldList($match[1]) as $name => $spec) {
                 $this->data[$name] = null;
             }
         }
     }
 }
 public function __construct($initHitsPerPage = null, $pageVar = null, $hitsVar = null)
 {
     // requirements
     Requirements::javascript(ABC_PATH . '/javascript/pagination.js');
     // Set up environment
     $this->pageVar = $pageVar ? $pageVar : self::$defaultPageVar;
     $this->hitsVar = $hitsVar ? $hitsVar : self::$defaultHitsVar;
     $this->initHitsPerPage = $initHitsPerPage ? $initHitsPerPage : self::$defaultInitHitsPerPage;
     // Set the Pagination Vars
     $page = empty($_GET[$this->pageVar]) || !is_numeric($_GET[$this->pageVar]) || (int) $_GET[$this->pageVar] < 1 ? 1 : (int) $_GET[$this->pageVar];
     $hits = empty($_GET[$this->hitsVar]) || !is_numeric($_GET[$this->hitsVar]) || (int) $_GET[$this->hitsVar] < 1 ? $this->initHitsPerPage : (int) $_GET[$this->hitsVar];
     $this->currentPage = $page;
     $this->start = $page == 1 ? 0 : $hits * ($page - 1);
     $this->limit = $hits;
     parent::__construct();
 }
 /**
  * Create a new DataObjectSet. If you pass one or more arguments, it will try to convert them into {@link ArrayData} objects. 
  * @todo Does NOT automatically convert objects with complex datatypes (e.g. converting arrays within an objects to its own DataObjectSet)							
  * 
  * @param ViewableData|array|mixed $items Parameters to use in this set, either as an associative array, object with simple properties, or as multiple parameters.
  */
 public function __construct($items = null)
 {
     if ($items) {
         // if the first parameter is not an array, or we have more than one parameter, collate all parameters to an array
         // otherwise use the passed array
         $itemsArr = !is_array($items) || count(func_get_args()) > 1 ? func_get_args() : $items;
         // We now have support for using the key of a data object set
         foreach ($itemsArr as $i => $item) {
             if (is_subclass_of($item, 'ViewableData')) {
                 $this->items[$i] = $item;
             } elseif (is_object($item) || ArrayLib::is_associative($item)) {
                 $this->items[$i] = new ArrayData($item);
             } else {
                 user_error("DataObjectSet::__construct: Passed item #{$i} is not an object or associative array, \n\t\t\t\t\t\tcan't be properly iterated on in templates", E_USER_WARNING);
                 $this->items[$i] = $item;
             }
         }
     }
     parent::__construct();
 }
Ejemplo n.º 29
0
 /**
  * Create a new form, with the given fields an action buttons.
  * @param controller The parent controller, necessary to create the appropriate form action tag.
  * @param name The method on the controller that will return this form object.
  * @param fields All of the fields in the form - a {@link FieldSet} of {@link FormField} objects.
  * @param actions All of the action buttons in the form - a {@link FieldSet} of {@link FormAction} objects
  */
 function __construct($controller, $name, FieldSet $fields, FieldSet $actions, $validator = null)
 {
     parent::__construct();
     foreach ($fields as $field) {
         $field->setForm($this);
     }
     foreach ($actions as $action) {
         $actions->setForm($this);
     }
     $this->fields = $fields;
     $this->actions = $actions;
     $this->controller = $controller;
     $this->name = $name;
     // Form validation
     if ($validator) {
         $this->validator = $validator;
         $this->validator->setForm($this);
     }
     // Form error controls
     $errorInfo = Session::get("FormInfo.{$this->FormName()}");
     if (isset($errorInfo['errors']) && is_array($errorInfo['errors'])) {
         foreach ($errorInfo['errors'] as $error) {
             $field = $this->fields->dataFieldByName($error['fieldName']);
             if (!$field) {
                 $errorInfo['message'] = $error['message'];
                 $errorInfo['type'] = $error['messageType'];
             } else {
                 $field->setError($error['message'], $error['messageType']);
             }
         }
         // load data in from previous submission upon error
         if (isset($errorInfo['data'])) {
             $this->loadDataFrom($errorInfo['data']);
         }
     }
     if (isset($errorInfo['message']) && isset($errorInfo['type'])) {
         $this->setMessage($errorInfo['message'], $errorInfo['type']);
     }
 }
 /**
  * @param string $url
  * @param File $file
  */
 public function __construct($url, File $file = null)
 {
     $this->url = $url;
     $this->file = $file;
     $this->failover = $file;
     parent::__construct();
 }