Example #1
0
 function loadAssignField2()
 {
     require_once _base_ . '/lib/lib.table.php';
     $arr_fields = $_POST[$this->id]['field_set'];
     $idst_group = $_POST[$this->id]['idst_group'];
     $idst_desc = $_POST[$this->id]['idst_desc'];
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     $fl = new FieldList();
     $arr_all_fields = $fl->getAllFields();
     require_once _base_ . '/lib/lib.form.php';
     $form = new Form();
     $tree .= $form->openElementSpace();
     $tree .= $this->printState();
     // print custom fields status
     $arr_fields_normal = $fl->getFieldsFromIdst(array($idst_group));
     $arr_fields_descend = $fl->getFieldsFromIdst(array($idst_desc));
     foreach ($arr_fields_descend as $id_field => $field) {
         $arr_fields_normal[$id_field] = $field;
     }
     $tree .= $form->getHidden($this->id . '_idst_group', $this->id . '[idst_group]', $idst_group);
     $tree .= $form->getHidden($this->id . '_idst_desc', $this->id . '[idst_desc]', $idst_desc);
     foreach ($arr_fields as $id_filed => $status) {
         $tree .= $form->getHidden($this->id . '_' . $id_filed, $this->id . '[field_set][' . $id_filed . ']', $status);
     }
     /*
     $tree .= $form->openFormLine();
     $tree .= '<div class="label_effect">&nbsp;</div>';
     $tree .= '<div class="label_head">'.$this->lang->def('_MANDATORY').'</div>';
     $tree .= '<div class="label_head">'.$this->lang->def('_ORG_CHART_FIELD_WRITE').'</div>';
     $tree .= $form->closeFormLine();
     */
     $tb = new Table(0, $this->lang->def('_TITLE'), $this->lang->def('_TITLE'));
     $tb->setTableStyle('tree_org_table_field');
     $tb->addHeadCustom('<tr class="first_intest">' . '<th scope="col" abbr="' . $this->lang->def('_NAME') . '">' . $this->lang->def('_FIELD_NAME') . '</th>' . '<th scope="col" abbr="' . $this->lang->def('_MANDATORY') . '">' . $this->lang->def('_MANDATORY') . '</th>' . '<th scope="col" abbr="' . $this->lang->def('_ORG_CHART_FIELD_WRITE_ABBR') . '">' . $this->lang->def('_ORG_CHART_FIELD_WRITE') . '</th>' . '</tr>');
     // checkbox for mandatory and useraccess
     foreach ($arr_fields as $id_filed => $status) {
         if ($status == ORG_CHART_FIELD_NORMAL || $status == ORG_CHART_FIELD_DESCEND) {
             /*$tree .= $form->openFormLine();
             		// field title
             		$tree .= '<div class="label_effect">'.$arr_all_fields[$id_filed][FIELD_INFO_TRANSLATION].'</div>';
             		// checkbox for mandatory
             		$tree .= '<input class="checkbox" type="checkbox"'
             					.' id="'.$this->id.'_'.$id_filed.'_mandatory"'
             					.' name="'.$this->id.'[field_mandatory]['.$id_filed.']"'
             					.' value="true"';
             		if( isset( $arr_fields_normal[$id_filed] ) && $arr_fields_normal[$id_filed][FIELD_INFO_MANDATORY] == 'true' )
             			$tree .= ' checked="checked"';
             		$tree .= ' />';
             		$tree .= $form->getLabel( $this->id.'_'.$id_filed.'_mandatory', $this->lang->def('_MANDATORY'), 'label_bold access-only' );
             		// checkbox for useraccess
             		$tree .= '<input class="checkbox" type="checkbox"'
             					.' id="'.$this->id.'_'.$id_filed.'_useraccess"'
             					.' name="'.$this->id.'[field_useraccess]['.$id_filed.']"'
             					.' value="readwrite"';
             		if( isset( $arr_fields_normal[$id_filed] ) && $arr_fields_normal[$id_filed][FIELD_INFO_USERACCESS] == 'readwrite' )
             			$tree .= ' checked="checked"';
             		$tree .= ' />';
             		$tree .= $form->getLabel( $this->id.'_'.$id_filed.'_useraccess', $this->lang->def('_ORG_CHART_FIELD_WRITE'), 'label_bold access-only' );
             		$tree .= $form->closeFormLine();*/
             $input_manadatory = '<input class="checkbox" type="checkbox"' . ' id="' . $this->id . '_' . $id_filed . '_mandatory"' . ' name="' . $this->id . '[field_mandatory][' . $id_filed . ']"' . ' value="true"';
             if (isset($arr_fields_normal[$id_filed]) && $arr_fields_normal[$id_filed][FIELD_INFO_MANDATORY] == 'true') {
                 $input_manadatory .= ' checked="checked"';
             }
             $input_manadatory .= ' />' . $form->getLabel($this->id . '_' . $id_filed . '_mandatory', $this->lang->def('_MANDATORY'), 'label_bold access-only');
             $input_useraccess = '<input class="checkbox" type="checkbox"' . ' id="' . $this->id . '_' . $id_filed . '_useraccess"' . ' name="' . $this->id . '[field_useraccess][' . $id_filed . ']"' . ' value="readwrite"';
             if (isset($arr_fields_normal[$id_filed]) && $arr_fields_normal[$id_filed][FIELD_INFO_USERACCESS] == 'readwrite') {
                 $input_useraccess .= ' checked="checked"';
             }
             $input_useraccess .= ' />' . $form->getLabel($this->id . '_' . $id_filed . '_useraccess', $this->lang->def('_ORG_CHART_FIELD_WRITE'), 'label_bold access-only');
             $tb->addHeadCustom('<tr>' . '<th scope="row">' . $arr_all_fields[$id_filed][FIELD_INFO_TRANSLATION] . '</th>' . '<td>' . $input_manadatory . '</td>' . '<td>' . $input_useraccess . '</td>' . '</tr>');
         }
     }
     $tree .= $tb->getTable();
     $tree .= $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save_assignfield' . $this->id, $this->id . '[save_assignfield]', $this->lang->def('_SAVE')) . $form->getButton($this->_getCancelId(), $this->_getCancelId(), $this->lang->def('_UNDO')) . $form->closeButtonSpace();
     return $tree;
 }