$_type_options_complite = array(); $DbManager = & CreateObject('DbSimple_Manager'); $_type_options_complite = $DbManager->selectCol('SELECT type AS ARRAY_KEY, type FROM granat_documents_types GROUP BY type'); foreach (explode(',', $GLOBALS['Loader']->Profile->ActiveDocumentNode->_type) as $_type) { switch ($_type) { case 'basedocument': $_type_options = array( 'datamodel' => 'Хранилище данных', 'sitemodel' => 'Новый сайт', ); break; case 'formcontainer': $_type_options = array( 'formelement_text' => 'Text field', 'formelement_checkbox' => 'Checkbox field', 'formelement_password' => 'Password field', 'formelement_hidden' => 'Hidden field', 'formelement_textarea' => 'Textarea field', 'formelement_file' => 'File field', 'formelement_antispam' => 'Antispam field', 'formelement_select' => 'Select field', 'formelement_submit' => 'Submit button', 'formelement_ruleonly' => 'Rule only', ); break; case 'formelement': $_type_options = array( 'options' => 'Element Options', 'checkrules' => 'Element CheckRules', ); break; case 'options': $_type_options = array( 'option' => 'Element Option', ); break; case 'checkrules': $_type_options = array( 'checkrules_nn' => 'Rule: NotNull', 'checkrules_email' => 'Rule: Email', 'checkrules_word' => 'Rule: Word', 'checkrules_numeric' => 'Rule: Numeric', 'checkrules_url' => 'Rule: Url', 'checkrules_phone' => 'Rule: Phone', 'checkrules_date' => 'Rule: Date', 'checkrules_length' => 'Rule: Length', 'checkrules_match' => 'Rule: RegExp', 'checkrules_setstr' => 'Filter: SetStr', 'checkrules_setslot' => 'Filter: SetSlot', 'checkrules_copyparam' => 'Filter: CopyParam', ); break; default: $_type_options = array( 'webpage' => 'Web-node', 'formcontainer' => 'Form Container', ); break; } $_type_options_complite = array_merge($_type_options, array('' => ''), $_type_options_complite); } $_type_options = $_type_options_complite; return array( 'alias' => array( '_rule' => 'trim; nn; ~childexist', '', 'Алиас нового документа не должен быть пустым!', 'Такой алиас уже используется', 'type' => 'text', 'caption' => 'Алиас', 'default' => '', ), 'caption' => array( '_rule' => 'trim; nn', '', 'Заголовок нового документа не должен быть пустым!', 'type' => 'text', 'caption' => 'Заголовок', 'default' => '', ), 'type' => array( '_rule' => 'trim; nn', '', 'Тип нового документа не должен быть пустым!', 'type' => 'select', 'caption' => 'Тип документа', 'default' => '', 'options' => $_type_options, ), 'documentadd' => array( '_rule' => '', 'type' => 'submit', 'caption' => 'Добавить', ), );