예제 #1
0
 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  * @param bool $generate Generate password (boolean)
  * @param array $restrictions
  */
 public function __construct($name, $flags = 0, $generate = false, $restrictions = [])
 {
     $flags = $flags | self::AF_HIDE_SEARCH;
     $this->m_generate = $generate;
     parent::__construct($name, $flags);
     $this->setRestrictions($restrictions);
 }
예제 #2
0
 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  * @param int $decimals The number of decimals to use.
  */
 public function __construct($name, $flags = 0, $decimals = null)
 {
     $flags = $flags | self::AF_NO_QUOTES;
     parent::__construct($name, $flags);
     $this->m_decimals = $decimals;
     $this->m_decimalseparator = Tools::atktext(self::SEPARATOR_DECIMAL, 'atk');
     $this->m_thousandsseparator = Tools::atktext(self::SEPARATOR_THOUSAND, 'atk');
 }
예제 #3
0
 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  */
 public function __construct($name, $flags = 0)
 {
     parent::__construct($name, $flags);
     $this->setAttribSize(1);
     if ($this->hasFlag(self::AF_BOOL_OBLIGATORY)) {
         $this->addFlag(self::AF_OBLIGATORY);
     }
 }
예제 #4
0
파일: FieldSet.php 프로젝트: sintattica/atk
 /**
  * Constructor.
  *
  * @param string $name fieldset name
  * @param int $flags flags
  * @param string $template template string
  */
 public function __construct($name, $flags = 0, $template)
 {
     $flags = $flags | self::AF_NO_SORT | self::AF_HIDE_SEARCH;
     parent::__construct($name, $flags);
     $this->setTemplate($template);
     $this->setLoadType(self::NOLOAD);
     $this->setStorageType(self::NOSTORE);
 }
예제 #5
0
 /**
  * The fuzzySearchAttribute, with this you can search a node for certain keywords
  * and get a selectable list of records that match the keywords.
  * Possible modes:
  * - all (default)    return everything
  * - first            return only the first result
  * - firstperkeyword  return the first result per keyword
  * - select           make the user select
  * - selectperkeyword make the user select for every keyword
  * - multiselect      ?
  *
  * @param string $name The name of the attribute
  * @param int $flags The flags of the attribute
  * @param string $searchnode The node to search on
  * @param string $callback The function of the owner node to call
  *                           with the record to store and the results of the search
  *                           Has to return a status (true or false)
  * @param string $mode The mode of the search (all(default)|first|firstperkeyword|
  *                           select|selectperkeyword|multiselect)
  */
 public function __construct($name, $flags = 0, $searchnode, $callback, $mode = 'all')
 {
     $flags = $flags | self::AF_HIDE_VIEW | self::AF_HIDE_LIST;
     parent::__construct($name, $flags);
     $this->m_searchnode = $searchnode;
     $this->m_callback = $callback;
     $this->m_mode = strtolower($mode);
 }
예제 #6
0
 /**
  * Constructor.
  *
  * Options can be an array using the following format:
  * array('option_a', 'option_b' => 'option_b_details')
  *
  * The options can either be specified as value (by not specifying a key)
  * or as key in which case you need to specify an attribute name as
  * value of another attribute which renders the detail selection for the
  * given option.
  *
  * @param string $name attribute name
  * @param int $flags
  * @param string $options can either be an array of values or a key/value
  *                        array in which case the key is used for the
  *                        translation and value is the value which is saved
  *                        in the database
  * @param array $details allows you to specify attributes that should be
  *                        used for the detail selection for certain options
  *                        the key should be the option value and the value
  *                        should be the attribute name
  */
 public function __construct($name, $flags = 0, $options, $details)
 {
     parent::__construct($name, $flags);
     $this->m_options = isset($options[0]) ? array_combine($options, $options) : $options;
     // Cast single detail attributes to arrays
     foreach ($details as $value => $detail) {
         $this->m_details[$value] = (array) $detail;
     }
 }
예제 #7
0
 /**
  * Constructor.
  *
  * @param string $name The name of the attribute.
  * @param int $flags The flags for this attribute.
  * @param string $expression The SQL expression.
  * @param string $searchType The search type (string) for this attribute.
  * At the moment only search types "string", "number" and "date" are supported.
  */
 public function __construct($name, $flags = 0, $expression, $searchType = '')
 {
     $flags = $flags | self::AF_HIDE_ADD | self::AF_READONLY_EDIT;
     parent::__construct($name, $flags);
     $this->m_expression = $expression;
     if ($searchType != '') {
         $this->setSearchType($searchType);
     }
 }
예제 #8
0
 /**
  * Constructor.
  *
  * @param string $name The name of the attribute
  * @param int $flags The flags of this attribute
  * @param string $parentAttrName
  * @return ProfileAttribute
  */
 public function __construct($name, $flags = 0, $parentAttrName = '')
 {
     $flags = $flags | self::AF_HIDE_SEARCH | self::AF_HIDE_LIST;
     parent::__construct($name, $flags);
     $this->m_parentAttrName = $parentAttrName;
     $this->m_accessField = Config::getGlobal('auth_accessfield');
     if (empty($this->m_accessField)) {
         $this->m_accessField = Config::getGlobal('auth_levelfield');
     }
 }
예제 #9
0
 /**
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  * @param int $beginTime Time to start with (eg 8)
  * @param int $endTime Time to end with (eg 24)
  * @param int|array $steps containing possible minute or seconds values (eg array("00","15","30","45"))
  *                             or the interval (eg 5 for 00,05,10,15, etc.)
  *                             if the flag self::AF_TIME_SECONDS is set, this is for seconds, the minutes will be range(0, 59)
  *                             else this is for the minutes and the seconds will not be displayed
  */
 public function __construct($name, $flags = 0, $beginTime = 0, $endTime = 23, $steps = ['00', '15', '30', '45'])
 {
     parent::__construct($name, $flags);
     $this->m_beginTime = $beginTime;
     $this->m_endTime = $endTime;
     if (is_array($steps)) {
         $this->m_steps = $steps;
     } else {
         $this->m_steps = $this->intervalToSteps($steps);
     }
 }
예제 #10
0
 /**
  * Constructor.
  *
  * @param string $name The name of the attribute
  * @param int $flags The flags for this attribute
  * @param array $tabs The arrays looks like array("tabname1"=>("attribname1,"attribname2),"tabname1"=>(..),..)
  */
 public function __construct($name, $flags = 0, $tabs = [])
 {
     // A TabbedPane attribute should be display only in edit/view mode
     $flags = $flags | self::AF_HIDE_SEARCH | self::AF_HIDE_LIST | self::AF_HIDE_SELECT;
     foreach ($tabs as $tab => $attribs) {
         foreach ($attribs as $attrib) {
             $this->add($attrib, $tab);
         }
     }
     parent::__construct($name, $flags);
 }
예제 #11
0
 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  */
 public function __construct($name, $flags = 0)
 {
     $default_steps = [];
     for ($i = 0; $i < 60; ++$i) {
         $default_steps[$i] = $i;
     }
     $this->m_date = new DateAttribute($name, $flags);
     $this->m_time = new TimeAttribute($name, $flags, 0, 23, $default_steps);
     parent::__construct($name, $flags);
     // base class constructor
 }
예제 #12
0
 /**
  * Constructor.
  *
  * @param string $name The name of the attribute
  * @param int $flags The flags for this attribute
  * @param string $text The text to display
  */
 public function __construct($name, $flags = 0, $text = '')
 {
     // A Dummy attrikbute should not be searchable and sortable
     $flags |= self::AF_HIDE_SEARCH | self::AF_NO_SORT;
     // Add the self::AF_BLANKLABEL flag unless the self::AF_DUMMY_SHOW_LABEL flag wasn't present
     if (!Tools::hasFlag($flags, self::AF_DUMMY_SHOW_LABEL)) {
         $flags |= self::AF_BLANKLABEL;
     }
     parent::__construct($name, $flags);
     // base class constructor
     $this->m_text = $text;
 }
예제 #13
0
 /**
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  * @param array $options: rows, cols, autoadjust
  */
 public function __construct($name, $flags = 0, $options = [])
 {
     parent::__construct($name, $flags);
     if (isset($options['rows'])) {
         $this->m_rows = $options['rows'];
     }
     if (isset($options['cols'])) {
         $this->m_cols = $options['cols'];
     }
     if (isset($options['autoadjust'])) {
         $this->m_autoadjust = $options['autoadjust'];
     }
 }
예제 #14
0
 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  * @param string $template Display/sort template.
  * @param array $searchFields Array with fields, in which search will be perform. If ommited, fields from $template will be used
  */
 public function __construct($name, $flags = 0, $template, $searchFields = [])
 {
     $flags = $flags | self::AF_HIDE_EDIT | self::AF_HIDE_ADD | self::AF_HIDE_VIEW;
     parent::__construct($name, $flags);
     // base class constructor
     $this->m_template = $template;
     $parser = new StringParser($template);
     $this->m_displayfields = $parser->getFields();
     if (!count($searchFields)) {
         $this->m_searchfields = $this->m_displayfields;
     } else {
         $this->m_searchfields = $searchFields;
     }
 }
예제 #15
0
 public function __construct($name, $flags = 0)
 {
     if (self::AF_POPUP === ($flags & self::AF_POPUP)) {
         $this->m_newWindow = true;
         $flags &= ~self::AF_POPUP;
     }
     if (self::AF_URL_ALLOWWRAP === ($flags & self::AF_URL_ALLOWWRAP)) {
         $this->m_allowWrap = true;
         $flags &= ~self::AF_URL_ALLOWWRAP;
     }
     if (self::AF_URL_STRIPHTTP === ($flags & self::AF_URL_STRIPHTTP)) {
         $this->m_stripHttp = true;
         $flags &= ~self::AF_URL_STRIPHTTP;
     }
     parent::__construct($name, $flags);
 }
예제 #16
0
 /**
  * Default Constructor, sets up Attribute.
  *
  * @param string $name The name of this attribute
  * @param int $flags The falgs of this attribute
  * @param string $resolution
  * @param string $maxtime
  *
  * @see Attribute
  */
 public function __construct($name, $flags = 0, $resolution = '1m', $maxtime = '10h')
 {
     parent::__construct($name, $flags);
     $hms = substr($resolution, -1);
     $resolution = substr($resolution, 0, -1);
     if (strtoupper($hms) == 'H') {
         $factor = 60;
     } else {
         $factor = 1;
     }
     $this->m_resolution_min = $resolution * $factor;
     $hms = substr($maxtime, -1);
     $maxtime = substr($maxtime, 0, -1);
     if (strtoupper($hms) == 'H') {
         $factor = 60;
     } else {
         $factor = 1;
     }
     $this->m_maxtime_min = $maxtime * $factor;
 }
예제 #17
0
 /**
  * Default Constructor, sets up the atkDateAttribute
  * The API of this method has changed, but is has been made
  * backwards compatible with existing modules!
  *
  * @param string $name the attribute's name
  * @param int $flags the attribute's flags
  * @param string $format_edit the format the edit/add box(es) will look like
  * @param string $format_view the format in which dates are listed
  * @param mixed $min the minimum date that has to be selected (0 is unlimited)
  * @param mixed $max the maximum date that may be selected (0 is unlimited)
  *
  * @see Attribute
  */
 public function __construct($name, $flags = 0, $format_edit = '', $format_view = '', $min = 0, $max = 0)
 {
     /* edit and display date format */
     $this->setFormatEdit($format_edit);
     $this->setFormatView($format_view);
     /* max / min date */
     $this->setDateMin($min);
     $this->setDateMax($max);
     /* base class constructor */
     parent::__construct($name, $flags);
 }
예제 #18
0
 /**
  * Constructor.
  *
  * <b>Example:</b>
  * <code>
  *   $this->add(new atkEmailAttribute("email", false, self::AF_OBLIGATORY));
  * </code>
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for the attribute
  * @param bool $search Search DNS for MX records in validate function
  */
 public function __construct($name, $flags = 0, $search = false)
 {
     $this->m_dnsSearch = $search;
     parent::__construct($name, $flags);
 }
예제 #19
0
 /**
  * Constructor.
  *
  * @param string $name Unique name of this attribute within the node.
  * @param int $flags Flags of the attribute.
  * @param string $calculation The calculation to perform. Must be a valid php expression.
  */
 public function __construct($name, $flags = 0, $calculation)
 {
     $flags = $flags | self::AF_NO_SORT | self::AF_HIDE_SEARCH | self::AF_READONLY;
     parent::__construct($name, $flags);
     $this->m_calculation = $calculation;
 }
예제 #20
0
파일: Relation.php 프로젝트: sintattica/atk
 /**
  * Constructor.
  *
  * @param string $name The name of the relation.
  * @param int $flags Flags for the relation
  * @param string $destination The destination node (in module.name notation)
  */
 public function __construct($name, $flags = 0, $destination)
 {
     parent::__construct($name, $flags);
     $this->m_destination = $destination;
 }
예제 #21
0
 /**
  * Constructor.
  *
  * @param string $name attribute name
  * @param int $flags attribute flags.
  */
 public function __construct($name, $flags = 0)
 {
     parent::__construct($name, $flags);
     $this->setAttribSize(15);
 }
예제 #22
0
 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  * @param array $dir Can be a string with the Directory with images/files or an array with a Directory and a Display Url
  */
 public function __construct($name, $flags = 0, $dir)
 {
     $flags = $flags | self::AF_CASCADE_DELETE;
     parent::__construct($name, $flags);
     $this->setDir($dir);
     $this->setStorageType(self::POSTSTORE | self::ADDTOQUERY, 'update');
     $this->setStorageType(self::POSTSTORE | self::ADDTOQUERY, 'add');
 }
예제 #23
0
 /**
  * Constructor.
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  * @param string $text text field
  */
 public function __construct($name, $flags = 0, $text)
 {
     $flags = $flags | self::AF_HIDE_SEARCH | self::AF_NO_SORT;
     $this->m_text = $text;
     parent::__construct($name, $flags);
 }
예제 #24
0
 /**
  * Constructor.
  *
  * Warning: very old versions of this attribute supported passing the
  * parameters in a different order: $name, $flags, $optionArray.
  * This order used to be supported even when the new order was
  * implemented, but it has now been removed. Keep this in mind
  * when upgrading from a very old ATK version (pre ATK4).
  *
  * @param string $name Name of the attribute
  * @param int $flags Flags for this attribute
  * @param array $optionArray Array with options
  * @param array $valueArray Array with values. If you don't use this parameter,
  *                            values are assumed to be the same as the options.
  */
 public function __construct($name, $flags = 0, $optionArray, $valueArray = null)
 {
     if (!is_array($valueArray) || count($valueArray) == 0) {
         $valueArray = $optionArray;
     }
     // If all values are numeric, we can use a numeric field to store the selected
     // value.
     $this->m_dbfieldtype = 'number';
     for ($i = 0, $_i = count($valueArray); $i < $_i && $this->m_dbfieldtype == 'number'; ++$i) {
         if (!is_numeric($valueArray[$i])) {
             $this->m_dbfieldtype = 'string';
         }
         // if one of the values is not a number, the fieldtype must be string, and
         // the loop is stopped.
     }
     // the max size we have is equal to the biggest value.
     $size = 0;
     for ($i = 0, $_i = count($valueArray); $i < $_i; ++$i) {
         $size = max($size, Tools::atk_strlen($valueArray[$i]));
     }
     if ($size > 0) {
         $this->setAttribSize($size);
     }
     parent::__construct($name, $flags);
     $this->setOptions($optionArray, $valueArray);
 }
예제 #25
0
 public function __construct($name, $flags = 0, $colorPickerOptions = [])
 {
     $this->colorPickerOptions = $colorPickerOptions;
     parent::__construct($name, $flags);
 }
예제 #26
0
파일: Filter.php 프로젝트: sintattica/atk
 /**
  * Constructor.
  *
  * @param string $name The name of the filter
  * @param int $flags The flags of the filter
  *
  * @return Filter
  */
 public function __construct($name, $flags = 0)
 {
     parent::__construct($name, $flags | Attribute::AF_HIDE | Attribute::AF_FORCE_LOAD);
 }
예제 #27
0
 /**
  * Constructor.
  *
  * <b>Example:</b>
  *        $this->add(new atkFormatAttribute("license", "AAA/##/##",
  *                                                        self::AF_OBLIGATORY));
  *
  * @todo Support for other types of input, upper/lowercase support,
  *       escape possibility for using literal *'s.
  *       Also, variable length parts would be nice.
  *       Finally, there should be an option if 'AA' accepts 'z' or only
  *       'zz'
  *
  * @param string $name Name of the attribute (unique within a node, and
  *                       corresponds to a field in the database.
  * @param int $flags Flags for the attribute.
  * @param string $format The format specifier. Each character defines
  *                       what type of input is expected.
  *                       Currently supported format characters:
  *                       * - Accept any character
  *                       # - Accept letter or digit
  *                       A - Accept a letter from the alphabet
  *                       9 - Accept a digit
  *                       Any other char is seen as a literal and displayed
  *                       literally as non-editable chars in the editor.
  */
 public function __construct($name, $flags = 0, $format)
 {
     $this->m_format = $format;
     parent::__construct($name, $flags);
     $this->setAttribSize(strlen($format));
 }