$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>'; $content .= '<div class="row">'; $content .= '<input type="submit" class="btn btn-primary btn-lg" name="add" value="' . Language::Word('save') . '">'; $content .= '</div>'; $content .= '</form>'; $title = Language::Word('language adding'); $header = $title; } } else { if (!isset($_REQUEST['id'])) { echo 'user id is unset'; exit; } $direction = Direction::FetchByID($_REQUEST['id']); $title = Language::Word('direction'); $header = htmlspecialchars($direction->name); $content = $direction->ToHTMLAutoFull(GetUserPrivileges()); } } } include_once $link_to_admin_template;
$tmp = Project::FetchByDirectionID($directions[$i]->id); if ($tmp !== NULL) { $projects = array_merge($projects, $tmp); } } $size = count($projects); if ($size) { require $link_to_pagination_init_template; for ($i = $from; $i <= $to; ++$i) { $project = $projects[$i]; if ($i === $from || $i > $from && $projects[$i - 1]->direction_id != $project->direction_id) { if ($i != $from) { $content .= '<hr>'; } $content .= '<div align="left" style="padding: 15px; background-color: #eeeeee;">'; $content .= Language::Word('direction') . ': ' . Direction::FetchByID($project->direction_id)->LinkToThis(); $content .= '</div><hr>'; } $content .= $project->ToHTMLAutoShortForTable(GetUserPrivileges()); } } else { $content .= ToPageHeader(Language::Word('no projects'), 'h3', 'black'); } $header .= Language::PublicMenu('projects'); } } } else { //Manage articles $content .= MenuButton(Language::PublicMenu('articles'), $_SERVER['PHP_SELF'] . '?content_type=' . $content_types_short['articles']); //Manage directions $content .= MenuButton(Language::PublicMenu('directions'), $_SERVER['PHP_SELF'] . '?content_type=' . $content_types_short['directions']);
if (Error::IsError($ob)) { $content .= AlertMessage('alert-danger', 'Error while receiving user: '******'recipient_ids'] = urldecode($assoc['recipient_ids']); $ob->FetchFromAssocEditing($assoc); $tmp = $ob->Save(); if (Error::IsError($tmp)) { $content .= AlertMessage('alert-danger', Language::Word('it was not succeeded to save') . ':error: ' . Error::ToString($tmp)); } else { $content .= AlertMessage('alert-success', Language::Word('changes are saved')); } break; case Direction::$type: $direction = Direction::FetchByID($_POST['id']); if ($direction === NULL) { break; } $direction->FetchFromAssocEditing($_POST); if ($direction->Save() === false) { $content .= AlertMessage('alert-danger', Language::Word('it was not succeeded to save')); } else { $content .= AlertMessage('alert-success', Language::Word('changes are saved')); if ($direction->FetchCoverFromAssocEditing($_FILES) < 0) { $content .= AlertMessage('alert-warning', Language::Word('cover was not uploaded')); } } break; case Project::$type: $project = Project::FetchByID($_POST['id']);
public static function Delete($id) { global $db_connection; global $link_to_direction_images; global $link_to_logo; $direction = Direction::FetchByID($id); $langs = $direction->FetchLanguages(); $from_table = Direction::$table; if ($direction->language !== 'rus') { $from_table .= '_' . $direction->language; } if (!$db_connection->query("DELETE FROM `" . $from_table . "` WHERE `id` = " . $id)) { return 0; } else { if (count($langs) < 2) { $projs = Project::FetchByDirectionID($id, array('all')); if ($projs != NULL) { for ($i = 0, $size = count($projs); $i < $size; ++$i) { if (!$projs[$i]->DeleteThis()) { echo 'error while deleting projects on proj id: ' . $projs[$i]->id; return 0; } } } removeDirectory($link_to_direction_images . $id); } else { if ($direction->path_to_image !== $link_to_logo) { unlink($direction->path_to_image); } } return 1; } }
public function ToHTMLUserPrivateShortInTable() { $author = User::FetchBy(['eq_conds' => ['id' => $this->author_id], 'select_list' => 'id, name, surname, login', 'is_unique' => true]); $res = '<tr>'; $res .= '<td>' . Direction::FetchByID($this->direction_id)->LinkToThis() . '</td>'; $res .= '<td>' . htmlspecialchars($this->name) . '</td>'; $res .= '<td>' . date('d : m : Y - H : i', $this->creating_date) . '</td>'; $res .= '<td>' . $author->LinkToThis() . '</td>'; $res .= '<td>'; $res .= '<div class="row">'; if (GetUserLogin() === $author->GetLogin() || GetUserLogin() === 'admin') { $res .= '<div class="' . ColAllTypes(4) . '">'; } else { $res .= '<div class="' . ColAllTypes(12) . '">'; } $res .= $this->ToHTMLFullVers(); $res .= '</div>'; if (GetUserLogin() === $author->GetLogin() || GetUserLogin() === 'admin') { $res .= '<div class="' . ColAllTypes(4) . '">'; $res .= $this->ToHTMLEdit(); $res .= '</div>'; $res .= '<div class="' . ColAllTypes(4) . '">'; $res .= $this->ToHTMLDel(); $res .= '</div>'; } $res .= '</div>'; $res .= '</td>'; $res .= '</tr>'; return $res; }