Exemplo n.º 1
0
 $direction = Direction::FetchByID($_REQUEST['id']);
 $dir_langs = $direction->FetchLanguages();
 $free_languages = array_diff($languages, $dir_langs);
 if (count($free_languages) === 0) {
     $content = AlertMessage('alert-danger', Language::Word('all languages of this direction is implemented'));
 } else {
     $id = User::GetIDByLogin($_SESSION['user_login']);
     clear_tmp_images_dir(Direction::$type, $id);
     global $link_to_utility_sql_worker;
     global $link_to_img_upload;
     global $link_to_img_browse;
     global $languages;
     $content .= '<form method="post" action="' . $link_to_utility_sql_worker . '" enctype="multipart/form-data">';
     $content .= PairLabelAndInput(4, 5, Language::Word('header'), 'name', Language::Word('insert header')) . '<br>';
     $content .= PairLabelAndInputFile(4, 5, Language::Word('cover'), 'cover');
     $content .= PairLabelAndSelect(4, 5, Language::Word('language'), 'language', $free_languages, array(key($free_languages), current($free_languages)));
     $content .= WrapToHiddenInputs(array('type' => Direction::$type, 'yes' => '', 'id' => $id, 'glob_id' => $direction->id));
     $content .= '<div class="row"><h3>' . Language::Word('text') . '</h3></div>';
     $content .= '<div class="row">';
     $content .= '<div class="' . ColAllTypes(8) . ' ' . ColOffsetAllTypes(2) . '" align="center">';
     $content .= '<textarea id="text_block" name="text_block"></textarea>';
     $content .= '</div>';
     $content .= '</div>';
     $content .= '<script>';
     $content .= 'CKEDITOR.replace("text_block",';
     $content .= '{ filebrowserImageUploadUrl: "' . $link_to_img_upload . '?type=' . Direction::$type . '&id=' . $id . '&add=add&glob_id=' . $direction->id . '",';
     $content .= 'filebrowserImageBrowseUrl : "' . $link_to_img_browse . '?type=' . Direction::$type . '&id=' . $direction->id . '&edit=edit",';
     $content .= 'contentsCss: [CKEDITOR.basePath + "contents.css", "css/styles.css", "css/bootstrap.min.css"],';
     $content .= 'allowedContent: true, });';
     $content .= 'CKEDITOR.config.height = 400;';
     $content .= '</script>';
Exemplo n.º 2
0
 public function ToHTMLEditing()
 {
     global $user_blocks_in_db;
     global $link_to_admin_user_block;
     global $positions;
     global $link_to_utility_sql_worker;
     $positions = Language::GetPositions();
     $res = '';
     $res .= '<form method="post" action="' . $link_to_utility_sql_worker . '" enctype="multipart/form-data">';
     $res .= '<div class="row">';
     $res .= '<div class="' . ColAllTypes(1) . '"></div>';
     $res .= '<div class="' . ColAllTypes(5) . ' vcenter" align="right">';
     $res .= '<div class="row">';
     $res .= '<img src="' . $this->path_to_photo . '" class="img-rounded img-avatar">';
     $res .= '</div>';
     $res .= '<div class="row">';
     $res .= PairLabelAndInputFile(3, 5, Language::Word('upload image'), 'img');
     $res .= '</div>';
     $res .= '</div>';
     $res .= '<div class="' . ColAllTypes(5) . ' vcenter" align="left">';
     $res .= PairLabelAndInput(2, 10, Language::Word('name'), 'name', Language::Word('insert name'), $this->name);
     $res .= PairLabelAndInput(2, 10, Language::Word('surname'), 'surname', Language::Word('insert surname'), $this->surname);
     $res .= PairLabelAndInput(2, 10, Language::Word('fathername'), 'fathername', Language::Word('insert fathername'), $this->fathername);
     if ($this->login != 'admin' && GetUserLogin() == 'admin') {
         $tmp = User::FetchAllByPosition(DirectorPositionNum);
         if (($tmp != NULL || GetUserLogin() != 'admin') && $this->position != DirectorPositionNum) {
             unset($positions[DirectorPositionNum]);
         }
         $res .= PairLabelAndSelect(2, 10, Language::Word('position'), 'position', $positions, $selected_field = array($this->position, $positions[$this->position]));
     } else {
         $res .= PairLabelAndPanel(2, 10, Language::Word('position'), htmlspecialchars(Language::Position($this->position)));
     }
     $res .= PairLabelAndInput(2, 10, Language::Word('mail'), 'email', Language::Word('insert mail'), $this->email);
     $res .= PairLabelAndInput(2, 10, Language::Word('telephone'), 'telephone', Language::Word('insert telephone'), $this->telephone);
     if ($this->login == GetUserLogin() && $this->login != 'admin') {
         $res .= PairLabelAndInput(2, 10, Language::Word('login'), 'login', Language::Word('insert login'), $this->login);
     } else {
         $res .= PairLabelAndPanel(2, 10, Language::Word('login'), $this->login);
     }
     $res .= PairLabelAndInput(2, 10, Language::Word('birthday'), 'birth_day', 'dd', date('j', $this->birthday));
     $res .= PairLabelAndInput(2, 10, Language::Word('birthmonth'), 'birth_month', 'mm', date('n', $this->birthday));
     $res .= PairLabelAndInput(2, 10, Language::Word('birthyear'), 'birth_year', 'yyyy', date('Y', $this->birthday));
     if ($this->login == GetUserLogin()) {
         $res .= PairLabelAndPassword(4, 8, Language::Word('old password'), 'password_old', Language::Word('only for password changing'));
         $res .= PairLabelAndPassword(4, 8, Language::Word('new password'), 'password_new1', Language::Word('only for password changing'));
         $res .= PairLabelAndPassword(4, 8, Language::Word('repeat new password'), 'password_new2', Language::Word('only for password changing'));
     }
     $res .= '</div>';
     $res .= '</div>';
     $res .= DialogInputsYesNo('edit', $_POST['type'], $_POST['id'], Language::Word('save'), Language::Word('cancel'));
     $res .= '</form>';
     return $res;
 }