当前位置: 首页>>代码示例>>PHP>>正文


PHP Posts::RenderForm方法代码示例

本文整理汇总了PHP中Posts::RenderForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::RenderForm方法的具体用法?PHP Posts::RenderForm怎么用?PHP Posts::RenderForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Posts的用法示例。


在下文中一共展示了Posts::RenderForm方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: IndexPollsViewPoll

function IndexPollsViewPoll($op)
{
    $id = SafeEnv($_GET['poll_id'], 11, int);
    System::database()->Select('polls', GetWhereByAccess('view', "`id`='{$id}' and `active`='1'"));
    if (System::database()->NumRows() == 0) {
        HackOff();
    }
    $poll = System::database()->FetchRow();
    $question = SafeDB($poll['question'], 255, str);
    System::site()->SetTitle($question);
    System::site()->BreadCrumbAdd($question);
    // Отвечал ли пользователь
    $ip = getip();
    if (System::user()->Auth) {
        $uid = System::user()->Get('u_id');
    } else {
        $uid = -1;
    }
    System::database()->Select('polls_voices', "`poll_id`='{$id}' and (`user_ip`='{$ip}' or `user_id`='{$uid}')");
    $viewresult = System::database()->NumRows() != 0;
    $viewresult = $viewresult || $op == 'viewresult' && (System::config('polls/show_results') == '1' || System::user()->isAdmin());
    $answers = unserialize($poll['answers']);
    $c = count($answers);
    $num_voices = 0;
    for ($i = 0; $i < $c; $i++) {
        $num_voices += SafeDB($answers[$i][2], 11, int);
    }
    if ($viewresult) {
        if ($num_voices != 0) {
            $per_c = 100 / $num_voices;
        } else {
            $per_c = 0;
        }
        System::site()->AddTemplatedBox('', 'module/poll_result.html');
        $vars = array('lresults_title' => 'Результаты опроса', 'lrvalue' => 'гол.');
        System::site()->AddBlock('poll_result_rows', true, true, 'pr');
        $c = count($answers);
        for ($i = 0; $i < $c; $i++) {
            if ($answers[$i][0] != '') {
                $title = SafeDB($answers[$i][0], 255, str);
                $color = SafeDB($answers[$i][1], 255, str);
                $value = round($per_c * $answers[$i][2]);
                $num_voices2 = SafeDB($answers[$i][2], 11, int);
                System::site()->AddSubBlock('poll_result_rows', true, array('answertext' => $title, 'value' => $value, 'num_voices' => $num_voices2, 'color' => $color));
            }
        }
    } else {
        System::site()->AddTemplatedBox('', 'module/poll.html');
        $vars = array();
        $vars['form_action'] = Ufu('index.php?name=polls&op=voice&poll_id=' . SafeDB($poll['id'], 11, int), 'polls/{poll_id}/voice/');
        System::site()->AddBlock('poll_variants', true, true, 'variant');
        for ($i = 0; $i < $c; $i++) {
            if ($answers[$i][0] != '') {
                $color = SafeDB($answers[$i][1], 255, str);
                $title = SafeDB($answers[$i][0], 255, str);
                if ($poll['multianswers'] == '1') {
                    $control = System::site()->Check('voice[]', $i);
                } else {
                    $control = System::site()->Radio('voice[]', $i);
                }
                System::site()->AddSubBlock('poll_variants', true, array('title' => $title, 'control' => $control, 'color' => $color));
            }
        }
        $vars['poll_showresults'] = System::config('polls/show_results') == '1' || System::user()->isAdmin();
        $vars['showresults_url'] = Ufu('index.php?name=polls&op=viewresult&poll_id=' . $id, 'polls/{poll_id}/results/');
        $vars['others_url'] = Ufu('index.php?name=polls', '{name}/');
    }
    $vars['title'] = $question;
    $vars['back_url'] = Ufu('index.php?name=polls', '{name}/');
    $vars['back_caption'] = 'Назад к списку';
    $vars['lnum_voices'] = 'Ответов';
    $vars['num_voices'] = $num_voices;
    $vars['lcomments'] = 'Комментариев';
    $vars['comments'] = SafeDB($poll['com_counter'], 11, int);
    System::site()->AddBlock('poll', true, false, '');
    System::site()->Blocks['poll']['vars'] = $vars;
    // Выводим комментарии
    if (isset($_GET['page'])) {
        $nav_page = SafeEnv($_GET['page'], 11, int);
    } else {
        $nav_page = 0;
    }
    $posts = new Posts('polls_comments', $poll['allow_comments'] == '1');
    $posts->PostFormAction = "index.php?name=polls&op=addpost&poll_id={$id}&page={$nav_page}";
    $posts->EditPageUrl = "index.php?name=polls&op=editpost&poll_id={$id}";
    $posts->DeletePageUrl = "index.php?name=polls&op=deletepost&poll_id={$id}";
    $posts->NavigationUrl = Ufu("index.php?name=polls&op=viewpoll&poll_id={$id}", 'polls/{poll_id}/page{page}/', true);
    $posts->RenderPosts($id, 'poll_comments', 'comments_navigation', false, $nav_page);
    $posts->RenderForm(false, 'poll_comments_form');
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:90,代码来源:index.php

示例2: CommentsEditPost

function CommentsEditPost($CommentsTable, $SaveUrl)
{
    System::site()->AddTemplatedBox('', 'edit_comment.html');
    $posts = new Posts($CommentsTable);
    $posts->PostFormAction = $SaveUrl;
    $posts->RenderForm(true, 'post_form');
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:7,代码来源:system_build.php

示例3: IndexGalleryView

function IndexGalleryView()
{
    if (isset($_GET['img'])) {
        $id = SafeEnv($_GET['img'], 11, int);
    } else {
        GO(GetSiteUrl() . Ufu('index.php?name=gallery', '{name}/'));
    }
    /*
     * Загружаем все изображения из категории и делаем массив соответствий index -> id, для определения следующего и
     * предыдущего изображения.
     */
    $cat = SafeEnv($_GET['cat'], 11, int);
    $db_images = System::database()->Select('gallery', GetWhereByAccess('view', "`cat_id`='{$cat}' and `show`='1'"), null, 'order');
    if (System::database()->NumRows() == 0) {
        GO(GetSiteUrl() . Ufu('index.php?name=gallery', '{name}/'));
    }
    $images = array();
    foreach ($db_images as $k => $img) {
        $images[$k] = $img['id'];
    }
    /*
     * Текущее изображение.
     */
    $index = array_search($id, $images);
    if ($index !== false) {
        $img = $db_images[$index];
    } else {
        GO(GetSiteUrl() . Ufu('index.php?name=gallery', '{name}/'));
    }
    /*
     * Добавляем блок изображения в шаблонизатор, блок будет содержать ссылки на следующее и предыдущее изображение.
     */
    $vars = IndexGalleryFilterImageData($img, $index + 1, count($db_images));
    $vars['next'] = isset($db_images[$index + 1]);
    if ($vars['next']) {
        $nimg = $db_images[$index + 1];
        $vars['next_url'] = Ufu('index.php?name=gallery&op=view&img=' . SafeDB($nimg['id'], 11, int) . '&cat=' . SafeDB($nimg['cat_id'], 11, int), 'gallery/{cat}/{img}/');
        $vars['next_title'] = SafeDB($nimg['title'], 255, str);
    }
    $vars['prev'] = isset($db_images[$index - 1]);
    if ($vars['prev']) {
        $nimg = $db_images[$index - 1];
        $vars['prev_url'] = Ufu('index.php?name=gallery&op=view&img=' . SafeDB($nimg['id'], 11, int) . '&cat=' . SafeDB($nimg['cat_id'], 11, int), 'gallery/{cat}/{img}/');
        $vars['prev_title'] = SafeDB($nimg['title'], 255, str);
    }
    if ($vars['title'] == '') {
        $vars['title'] = 'Изображение ' . strval($index + 1);
    }
    $GalleryImageBlock = System::site()->NewBlock('gallery_image', true, false, 'img')->SetVars($vars);
    /*
     * Выводим изображения в категории.
     */
    IndexGalleryShow($cat, $db_images, true, $GalleryImageBlock, $index);
    /*
     * Хлебные крошки, заголовок окна, подключение шаблона.
     */
    IndexGalleryGetTree()->BreadCrumbs($cat);
    System::site()->BreadCrumbAdd($vars['title']);
    System::site()->SetTitle($vars['title']);
    System::site()->AddTemplatedBox('', 'module/gallery_view.html');
    /*
     * Увеличиваем счётчик просмотров.
     */
    System::database()->Update('gallery', "`hits`='" . ($img['hits'] + 1) . "'", "`id`='{$id}'");
    /*
     * Выводим комментарии.
     */
    if (isset($_GET['page'])) {
        $page = SafeEnv($_GET['page'], 11, int);
    } else {
        $page = 0;
    }
    $posts = new Posts('gallery_comments', $img['allow_comments'] == '1');
    $posts->EditPageUrl = 'index.php?name=gallery&op=editpost&img=' . $id;
    $posts->DeletePageUrl = 'index.php?name=gallery&op=deletepost&img=' . $id;
    $posts->PostFormAction = "index.php?name=gallery&op=addpost&img={$id}&cat={$cat}&page={$page}";
    $posts->NavigationUrl = Ufu("index.php?name=gallery&op=view&img={$id}&cat={$cat}", 'gallery/{cat}/{img}/page{page}/', true);
    $posts->RenderPosts($id, 'gallery_comments', 'comments_navigation', false, $page);
    $posts->RenderForm(false, 'gallery_comments_form');
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:80,代码来源:index.php

示例4: IndexNewsReadFull

function IndexNewsReadFull()
{
    System::site()->AddTemplatedBox('', 'module/news_full.html');
    System::site()->AddBlock('news', true, true);
    if (isset($_GET['news'])) {
        $topics = IndexNewsGetTopics();
        $news_id = SafeEnv($_GET['news'], 11, int);
        $news = System::database()->SelectOne('news', GetWhereByAccess('view', "`id`='{$news_id}'"));
        if ($news && $news['enabled'] == '1') {
            // Новость включена
            System::site()->SetTitle(SafeDB($news['title'], 255, str));
            $topic_id = SafeDB($news['topic_id'], 11, int);
            $topic_title = SafeDB($topics[$topic_id]['title'], 255, str);
            System::site()->BreadCrumbAdd($topic_title, Ufu('index.php?name=news&topic=' . $topic_id, 'news/{topic}/'));
            System::site()->BreadCrumbAdd(SafeDB($news['title'], 255, str));
            //Модуль SEO
            System::site()->SeoTitle = SafeDB($news['seo_title'], 255, str);
            System::site()->SeoKeyWords = SafeDB($news['seo_keywords'], 255, str);
            System::site()->SeoDescription = SafeDB($news['seo_description'], 255, str);
            //
            IndexNewsAdd($news, $topic_title, true);
            System::database()->Update('news', "hit_counter='" . (SafeEnv($news['hit_counter'], 11, int) + 1) . "'", "`id`='" . $news_id . "'");
            // Выводим комментарии
            if (isset($_GET['page'])) {
                $page = SafeEnv($_GET['page'], 11, int);
            } else {
                $page = 0;
            }
            include_once System::config('inc_dir') . 'posts.class.php';
            $posts = new Posts('news_comments', $news['allow_comments'] == '1');
            $posts->EditPageUrl = "index.php?name=news&op=editpost&news={$news_id}";
            $posts->DeletePageUrl = "index.php?name=news&op=deletepost&news={$news_id}";
            $posts->PostFormAction = "index.php?name=news&op=addpost&news={$news_id}&topic={$topic_id}&page={$page}";
            $posts->NavigationUrl = Ufu("index.php?name=news&op=readfull&news={$news_id}&topic={$topic_id}", 'news/{topic}/{news}/page{page}/', true);
            $posts->NavigationAnchor = '#comments';
            $posts->RenderPosts($news_id, 'news_comments', 'comments_navigation', false, $page);
            $posts->RenderForm(false, 'news_comments_form');
        } else {
            System::site()->AddTextBox('Ошибка', '<p align="center">Эта новость не доступна в данный момент!<br><input type="button" value="Назад" onclick="history.back();"></p>');
        }
    } else {
        System::site()->AddTextBox('Ошибка', '<p align="center"><input type="button" value="Назад" onclick="history.back();"></p>');
    }
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:44,代码来源:index.php

示例5: IndexArticlesRead

function IndexArticlesRead()
{
    if (isset($_GET['art'])) {
        $id = SafeEnv($_GET['art'], 11, int);
    } else {
        GO(GetSiteUrl() . Ufu('index.php?name=articles', '{name}/'));
    }
    $where = "`id`='{$id}' and `active`='1'";
    System::database()->Select('articles', GetWhereByAccess('view', $where));
    if (System::database()->NumRows() == 0) {
        GO(GetSiteUrl() . Ufu('index.php?name=articles', '{name}/'));
    }
    $art = System::database()->FetchRow();
    System::database()->Update('articles', "hits='" . (SafeEnv($art['hits'], 11, int) + 1) . "'", $where);
    $cat = SafeDB($art['cat_id'], 11, int);
    // Показываем путь
    if (System::config('articles/show_catnav') == '1') {
        IndexArticlesGetTree()->BreadCrumbs($art['cat_id']);
    }
    System::site()->BreadCrumbAdd(SafeDB($art['title'], 255, str));
    System::site()->AddTemplatedBox('', 'module/article_read.html');
    System::site()->SetTitle(SafeDB($art['title'], 255, str));
    System::site()->SeoTitle = SafeDB($art['seo_title'], 255, str);
    System::site()->SeoKeyWords = SafeDB($art['seo_keywords'], 255, str);
    System::site()->SeoDescription = SafeDB($art['seo_description'], 255, str);
    RenderReadArticle($art);
    // Выводим комментарии
    if (isset($_GET['page'])) {
        $page = SafeEnv($_GET['page'], 11, int);
    } else {
        $page = 0;
    }
    $posts = new Posts('articles_comments', $art['allow_comments'] == '1');
    $posts->EditPageUrl = "index.php?name=articles&op=editpost&art={$id}";
    // Форма редактирования поста
    $posts->DeletePageUrl = "index.php?name=articles&op=deletepost&art={$id}";
    // Удаление поста
    $posts->PostFormAction = "index.php?name=articles&op=addpost&art={$id}&cat={$cat}";
    // Добавление поста (сохранение)
    $posts->NavigationUrl = Ufu("index.php?name=articles&op=read&art={$id}&cat={$cat}", 'articles/{cat}/{art}/page{page}/', true);
    $posts->NavigationAnchor = '#comments';
    $posts->RenderPosts($id, 'article_comments', 'comments_navigation', false, $page);
    $posts->RenderForm(false, 'article_comments_form');
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:44,代码来源:index.php

示例6: IndexDownloadsFull

function IndexDownloadsFull()
{
    if (isset($_GET['file'])) {
        $id = SafeEnv($_GET['file'], 11, int);
    } else {
        GO(GetSiteUrl() . Ufu('index.php?name=downloads', '{name}/'));
    }
    System::database()->Select('downloads', GetWhereByAccess('view', "`id`='{$id}' and `active`='1'"));
    if (System::database()->NumRows() == 0) {
        GO(GetSiteUrl() . Ufu('index.php?name=downloads', '{name}/'));
    }
    $file = System::database()->FetchRow();
    $cat = SafeDB($file['category'], 11, int);
    IndexDownloadsGetTree()->BreadCrumbs($cat);
    System::site()->BreadCrumbAdd(SafeDB($file['title'], 255, str));
    System::site()->SetTitle('Скачать ' . SafeDB($file['title'], 255, str));
    System::site()->AddTemplatedBox('', 'module/download_full.html');
    AddDetailDownload($file);
    // Выводим комментарии
    if (isset($_GET['page'])) {
        $page = SafeEnv($_GET['page'], 11, int);
    } else {
        $page = 0;
    }
    include_once System::config('inc_dir') . 'posts.class.php';
    $posts = new Posts('downloads_comments', $file['allow_comments'] == '1');
    $posts->EditPageUrl = "index.php?name=downloads&op=editpost&file={$id}";
    // Форма редактирования поста
    $posts->DeletePageUrl = "index.php?name=downloads&op=deletepost&file={$id}";
    // Удаление поста
    $posts->PostFormAction = "index.php?name=downloads&op=addpost&file={$id}&cat={$cat}&page={$page}";
    // Добавление поста (сохранение)
    $posts->NavigationUrl = Ufu("index.php?name=downloads&op=full&file={$id}&cat={$cat}", 'downloads/{cat}/{file}/page{page}/', true);
    $posts->NavigationAnchor = '#comments';
    $posts->RenderPosts($id, 'download_comments', 'comments_navigation', false, $page);
    $posts->RenderForm(false, 'download_comments_form');
}
开发者ID:agnyrussia,项目名称:linkorcms_mod_forms_file_support,代码行数:37,代码来源:index.php


注:本文中的Posts::RenderForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。