$content .= '<script>'; $content .= 'CKEDITOR.replace("text_block",'; $content .= '{ filebrowserImageUploadUrl: "' . $link_to_img_upload . '?type=' . TextPart::$type . '&id=' . $id . '&add=add&glob_id=' . $text_part->GetID() . '",'; $content .= 'filebrowserImageBrowseUrl : "' . $link_to_img_browse . '?type=' . TextPart::$type . '&id=' . $text_part->GetID() . '&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; } $text_part = TextPart::FetchByID($_REQUEST['id']); $title = ''; $header = ''; $content = ''; $title = Language::Word('text block'); $header = htmlspecialchars($text_part->GetName()); $content = $text_part->ToHTMLAutoFull(GetUserPrivileges()); } } } include_once $link_to_admin_template;
$content .= '<tbody>'; for ($i = $from; $i <= $to; ++$i) { $project = $projects[$i]; $content .= $project->ToHTMLAutoShortForTable(GetUserPrivileges()); } $content .= '</tbody>'; $content .= '</table>'; $content .= '</div>'; $content .= '</div>'; } else { $content .= ToPageHeader(Language::Word('absense'), 'h3', 'black'); } $header .= ' :' . Language::PublicMenu('projects'); } else { if ($_GET['content_type'] === $content_types_short['about_us']) { $parts = TextPart::FetchByRole('about_us'); $size = count($parts); if ($user->GetPositionNum() != NotEmployeeNum) { $content .= MenuButton(Language::Word('add text block'), $link_to_admin_text_part, 'btn-primary', 'add', 'get'); } if ($size) { require $link_to_pagination_init_template; $content .= '<div class="row">'; $content .= '<div class="' . ColAllTypes(12) . ' center-block">'; $content .= '<table class="table table-striped text-center">'; $content .= '<thead>'; $content .= '<tr>'; $content .= '<th class="text-center">' . Language::Word('object name') . '</th>'; $content .= '<th class="text-center">' . Language::Word('author') . '</th>'; $content .= '<th class="text-center">' . Language::Word('date') . '</th>'; $content .= '<th class="text-center">' . Language::Word('role') . '</th>';
public static function Delete($id) { global $db_connection; global $link_to_text_part_images; $txt_part = TextPart::FetchByID($id); $langs = $txt_part->FetchLanguages(); $from_table = TextPart::$table; if ($txt_part->language !== 'rus') { $from_table .= '_' . $txt_part->language; } if (!$db_connection->query("DELETE FROM `" . $from_table . "` WHERE `id` = " . $id)) { return 0; } else { if (count($langs) < 2) { removeDirectory($link_to_text_part_images . $id); } return 1; } }
} } break; case TextPart::$type: $assoc = $_POST; $assoc['author_id'] = $_POST['id']; unset($assoc['id']); $part = TextPart::FetchFromAssoc($assoc); if ($part === NULL) { $content = AlertMessage('alert-danger', Language::Word('error during text block adding')); } else { $glob_id = 0; if (isset($_POST['glob_id'])) { $glob_id = $_POST['glob_id']; } if (TextPart::InsertToDB($part, $_POST['language'], $glob_id)) { $content = AlertMessage('alert-success', Language::Word('text block is successfully added')); } else { $content = AlertMessage('alert-danger', Language::Word('error during text block inserting')); } } break; default: # code... break; } require_once $link_to_admin_template; exit; } else { echo 'id is not specified'; }