Example #1
0
     $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']);
     if ($project === NULL) {
         break;
     }
     $project->FetchFromAssocEditing($_POST);
     if ($project->Save() === false) {
         $content .= AlertMessage('alert-danger', Language::Word('it was not succeeded to save'));
     } else {
         $content .= AlertMessage('alert-success', Language::Word('changes are saved'));
     }
     break;
 case TextPart::$type:
     $txt_part = TextPart::FetchByID($_POST['id']);
     if ($txt_part === NULL) {
         break;
     }
Example #2
0
                $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=' . Project::$type . '&id=' . $id . '&add=add&glob_id=' . $project->id . '",';
                $content .= 'filebrowserImageBrowseUrl : "' . $link_to_img_browse . '?type=' . Project::$type . '&id=' . $project->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;
            }
            $project = Project::FetchByID($_REQUEST['id']);
            $title = Language::Word('project');
            $header = htmlspecialchars($project->name);
            $content = $project->ToHTMLAutoFull(GetUserPrivileges());
        }
    }
}
include_once $link_to_admin_template;
Example #3
0
 public static function Delete($id)
 {
     global $db_connection;
     global $link_to_projects_images;
     $project = Project::FetchByID($id);
     $langs = $project->FetchLanguages();
     $from_table = Project::$table;
     if ($project->language !== 'rus') {
         $from_table .= '_' . $project->language;
     }
     if (!$db_connection->query("DELETE FROM `" . $from_table . "` WHERE `id` = " . $id)) {
         return 0;
     } else {
         if (count($langs) < 2) {
             removeDirectory($link_to_projects_images . $id);
         }
         return 1;
     }
 }