/**
  * @param string $culture_code Code of current <CultureInfo>
  * @param mixed $date_format Chosen date format
  * @param mixed $time_format Chosen time format
  * @param string $timezone Currently chosen timezone
  * @param bool $append_timezone If true timezome will be appended
  */
 function __initialize($culture_code, $date_format, $time_format, $timezone = false, $append_timezone = false)
 {
     parent::__initialize();
     $this->script("Locale_Settings_Init();");
     store_object($this);
     if (!$timezone) {
         $timezone = Localization::getTimeZone();
     }
     $this->timezone = $timezone;
     $this->culture_code = $culture_code;
     $txt = $this->_sample(false, $date_format, $time_format);
     if ($append_timezone) {
         $txt .= " {$timezone}";
     }
     $sample = new Control('span');
     $sample->append("({$txt})")->css('color', 'gray');
     $cb = new CheckBox();
     $cb->setData('role', 'timeformatex')->setData('controller', buildQuery($this->id));
     $cb->value = 1;
     if ($append_timezone) {
         $cb->checked = "checked";
     }
     $lab = $cb->CreateLabel(tds("TXT_APPEND_TIMEZONE", "Append timezone") . " ");
     $lab->content($sample);
     $this->append($cb)->append($lab);
 }
Example #2
0
/**
 * @internal Stores all connections states
 */
function model_store()
{
    global $MODEL_DATABASES;
    foreach ($MODEL_DATABASES as $dbname => $db) {
        if (!is_array($db)) {
            store_object($db, $dbname);
        }
    }
}
 /**
  * @param array $options See http://plugins.jquery.com/project/Star_Rating_widget
  */
 function __initialize($options = array())
 {
     parent::__initialize("div");
     $this->Options = force_array($options);
     $this->Options['inputType'] = 'select';
     if (isset($this->Options['disabled'])) {
         $this->Options['disabled'] = true;
     }
     store_object($this);
 }
Example #4
0
 /**
  * @param string $id Id to be set
  * @param string $listType Type of list (ol|ul)
  */
 function __initialize($id = "", $listType = "ul")
 {
     if ($listType != "ul" || $listType != "ol") {
         $listType = "ul";
     }
     parent::__initialize($listType);
     if (!empty($id)) {
         $this->id = $id;
     }
     store_object($this);
 }
 /**
  * @param DataSource $datasource DataSource to use
  * @param string $datatype Datatype to be rendered
  * @param string $datatable Data tyble to be rendered
  */
 function __initialize($datasource, $datatype = false, $datatable = false)
 {
     parent::__initialize();
     $this->DataSource = $datasource;
     if ($datatype) {
         $this->DataTable = $this->DataSource->TableForType($datatype);
     } elseif ($datatable) {
         $this->DataTable = $datatable;
     }
     store_object($this);
 }
 /**
  * @param string $type Type of google visualization
  * @param array $options Options. Depends on $type
  * @param string $query A valid google query string. See [queryobjects](https://developers.google.com/chart/interactive/docs/reference#queryobjects)
  * @param DataSource $ds DataSource to use, will fall back to GoogleVisualization::$DefaultDatasource or (if that is not set) to <model_datasource>('internal')
  */
 function __initialize($type = false, $options = array(), $query = false, $ds = false)
 {
     parent::__initialize();
     $this->addClass('google_vis');
     $this->_ds = $ds ? $ds : (self::$DefaultDatasource ? self::$DefaultDatasource : model_datasource('internal'));
     $this->gvType = $type ? $type : substr(get_class_simple($this), 2);
     $this->gvOptions = $options ? $options : array();
     $this->gvQuery = $query;
     $this->content("<div class='loading'>&nbsp;</div>");
     store_object($this);
 }
Example #7
0
 /**
  * Adds a Pager to the table
  * 
  * Will be displayed in the tables footer. See <Table::SetDataCallback> for details how to
  * add data to a paged table.
  * @param int $total_items Total number of items
  * @param int $items_per_page Items per page to be displayed
  * @param int $current_page One (1) based index of current page
  * @param int $max_pages_to_show Maximum links to pages to be shown
  * @return DatabaseTable `$this`
  */
 function AddPager($total_items, $items_per_page = 15, $current_page = 1, $max_pages_to_show = 10)
 {
     $this->TotalItems = $total_items;
     $this->ItemsPerPage = $items_per_page;
     $this->CurrentPage = $current_page;
     $this->MaxPagesToShow = $max_pages_to_show;
     store_object($this);
     return $this;
 }
Example #8
0
 /**
  * Ensures object validity
  * 
  * Calls <store_object> for every <Renderable> object in the object store to ensure that the stored 
  * objects really match the serialized ones. This is needed because fields/properties can change after
  * the initial save and our caching will hide that from system.
  * 
  * No need to call this manually, ScavixWDF will do!
  * @return void
  */
 function Update()
 {
     global $CONFIG;
     $_SESSION[$CONFIG['session']['prefix'] . "session_lastaccess"] = time();
     foreach ($GLOBALS['object_storage'] as $id => &$obj) {
         try {
             if ($obj instanceof Renderable) {
                 store_object($obj, $id);
             }
         } catch (Exception $ex) {
             WdfException::Log("updating session storage for object {$id} [" . get_class($obj) . "]", $ex);
         }
     }
 }
Example #9
0
function new_object()
{
    try {
        $name = params('name');
        $args = $_POST['args'];
        $argstr = $args;
        logit('POST: args ', $args);
        if (is_null($args) || $args == '[]') {
            logit("calling new {$name}()");
            $object = new $name();
            logit("got object:" . get_class($object));
        } else {
            logit('args b4 decode', $args);
            $args = json_decode($args, true);
            logit('args after decode', $args);
            if (is_array($args)) {
                $args = convert_objs($args);
                logit("args after conversion", $args);
                $argstr = join($args, ",");
                logit("argstr after join", $argstr);
            } else {
                $argstr = $args;
            }
            logit("calling " . "return new {$name}({$argstr});");
            $object = eval("return new {$name}({$argstr});");
        }
        store_object($object);
        $data = object_properties_to_hash($object);
        $results = array('json_class' => $name, 'data' => $data, 'id' => spl_object_hash($object));
        logit("results", $results);
        return json_encode($results);
    } catch (LoadError $e) {
        halt(422, array("exception" => "LoadError", "error" => $e->getMessage()));
    } catch (Exception $e) {
        logit('Exception ' . $e->getMessage());
        halt(422, array("exception" => get_class($e), "error" => $e->getMessage()));
        // return json_encode(array('error' => $e->getMessage()));
    }
}