public function __construct($info = NULL) { parent::__construct(); if (!$info) { return; } foreach ((array) $info as $key => $val) { $this->{$key} = $val; } }
/** * One stop shop for adding activate/deactivate functionality to your ActiveRecord * * @param ActiveRecord object that has 'active' in its table */ public static function activatorImage($ARobject, $opts = NULL) { global $siteDomain; if (!is_null($opts)) { extract($opts); if ($success) { $success = ", " . $success; } } if (!in_array('active', array_keys($ARobject->getColumns()))) { throw new Exception('This object does not have an \'active\' column.'); } if (AccelObject::backend()) { $activeToggleUrl = "http://" . ThemeHelper::singleton()->siteDomain() . "/accelsite/admin/?adminAction=activeToggle&adminLayout=empty"; } else { $activeToggleUrl = "/?ado=genericActiveToggle&layout=empty"; } $js = "\n \$('.activeToggle').click(function() {\n \$(this).html('" . str_replace('\'', '\\\'', self::adminIcon('activeToggleLoader')) . "');\n \$(this).load('{$activeToggleUrl}&ajax=true&activeToggle=' + \$(this).attr('myID') + '&toggleClass=' + \$(this).attr('myClass') {$success});\n return false;\n });"; AccelJS::findThis()->ready($js); return "<a href='#' myID='" . $ARobject->id() . "' myClass='" . $ARobject->getClass() . "' class='activeToggle'>" . self::activeImage($ARobject->active()) . "</a>"; }
public function requireDatePicker($opts = null) { $this->requireFile('jquery-ui-datepicker.min'); $buttonImage = isset($opts['buttonImage']) ? $opts['buttonImage'] : (AccelObject::backend() ? '/' : '') . 'accelFile/theme|admin/calendar.png'; if ($opts['maxDate']) { $additionalOpts .= ", maxDate: " . $opts['maxDate']; } if ($opts['minDate']) { $additionalOpts .= ", minDate: " . $opts['minDate']; } $this->ready("\$('input.date-picker').datepicker({showOn: 'both', buttonImage: '{$buttonImage}', buttonImageOnly: true, buttonText: 'Date Picker', yearRange: '2000:2055' {$additionalOpts} });"); return $this; }