• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ArtefactTypeComment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     require_once get_config('docroot') . 'artefact/lib.php';
     $configdata = $instance->get('configdata');
     $configdata['viewid'] = $instance->get('view');
     $configdata['simpledisplay'] = true;
     // This can be either an image or profileicon. They both implement
     // render_self
     $result = '';
     $artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
     if ($artefactid) {
         $artefact = $instance->get_artefact_instance($artefactid);
         $result = $artefact->render_self($configdata);
         $result = $result['html'];
         require_once get_config('docroot') . 'artefact/comment/lib.php';
         require_once get_config('docroot') . 'lib/view.php';
         $view = new View($configdata['viewid']);
         list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing);
     }
     $smarty = smarty_core();
     if ($artefactid) {
         $smarty->assign('commentcount', $commentcount);
         $smarty->assign('comments', $comments);
     }
     $smarty->assign('html', $result);
     return $smarty->fetch('blocktype:folder:folder.tpl');
 }
开发者ID:agwells,项目名称:Mahara-1,代码行数:27,代码来源:lib.php


示例2: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     $result = '';
     $artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
     if ($artefactid) {
         require_once get_config('docroot') . 'artefact/lib.php';
         $artefact = $instance->get_artefact_instance($artefactid);
         $configdata['hidetitle'] = true;
         $configdata['countcomments'] = true;
         $configdata['viewid'] = $instance->get('view');
         $configdata['blockid'] = $instance->get('id');
         $result = $artefact->render_self($configdata);
         $result = $result['html'];
         require_once get_config('docroot') . 'artefact/comment/lib.php';
         require_once get_config('docroot') . 'lib/view.php';
         $view = new View($configdata['viewid']);
         list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing);
     }
     $smarty = smarty_core();
     if ($artefactid) {
         $smarty->assign('commentcount', $commentcount);
         $smarty->assign('comments', $comments);
     }
     $smarty->assign('html', $result);
     return $smarty->fetch('blocktype:blogpost:blogpost.tpl');
 }
开发者ID:agwells,项目名称:Mahara-1,代码行数:27,代码来源:lib.php


示例3: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     // this will make sure to unserialize it for us
     $configdata['viewid'] = $instance->get('view');
     $result = '';
     $artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
     if ($artefactid) {
         $artefact = $instance->get_artefact_instance($artefactid);
         if (!file_exists($artefact->get_path())) {
             return;
         }
         $result = clean_html(file_get_contents($artefact->get_path()));
         require_once get_config('docroot') . 'artefact/comment/lib.php';
         require_once get_config('docroot') . 'lib/view.php';
         $view = new View($configdata['viewid']);
         list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing);
     }
     $smarty = smarty_core();
     if ($artefactid) {
         $smarty->assign('commentcount', $commentcount);
         $smarty->assign('comments', $comments);
     }
     $smarty->assign('html', $result);
     return $smarty->fetch('blocktype:html:html.tpl');
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:26,代码来源:lib.php


示例4: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     // this will make sure to unserialize it for us
     if (!isset($configdata['artefactid'])) {
         return '';
     }
     $id = $configdata['artefactid'];
     $image = $instance->get_artefact_instance($id);
     $wwwroot = get_config('wwwroot');
     $viewid = $instance->get('view');
     if ($image instanceof ArtefactTypeProfileIcon) {
         $src = $wwwroot . 'thumb.php?type=profileiconbyid&id=' . $id;
         $description = $image->get('title');
     } else {
         $src = $wwwroot . 'artefact/file/download.php?file=' . $id . '&view=' . $viewid;
         $description = $image->get('description');
     }
     if (!empty($configdata['width'])) {
         $src .= '&maxwidth=' . $configdata['width'];
     }
     require_once get_config('docroot') . 'artefact/comment/lib.php';
     require_once get_config('docroot') . 'lib/view.php';
     $view = new View($viewid);
     list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($image, $view, $instance->get('id'), true, $editing);
     $smarty = smarty_core();
     $smarty->assign('commentcount', $commentcount);
     $smarty->assign('comments', $comments);
     $smarty->assign('url', $wwwroot . 'artefact/artefact.php?artefact=' . $id . '&view=' . $viewid);
     $smarty->assign('src', $src);
     $smarty->assign('description', $description);
     $smarty->assign('showdescription', !empty($configdata['showdescription']) && !empty($description));
     return $smarty->fetch('blocktype:image:image.tpl');
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:34,代码来源:lib.php


示例5: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $USER;
     if ($editing) {
         $smarty = smarty_core();
         $smarty->assign('editing', get_string('ineditordescription1', 'blocktype.comment/comment'));
         $html = $smarty->fetch('blocktype:comment:comment.tpl');
         return $html;
     }
     // Feedback list pagination requires limit/offset params
     $limit = param_integer('limit', 10);
     $offset = param_integer('offset', 0);
     $showcomment = param_integer('showcomment', null);
     // Create the "make feedback private form" now if it's been submitted
     if (param_variable('make_public_submit', null)) {
         pieform(ArtefactTypeComment::make_public_form(param_integer('comment')));
     } else {
         if (param_variable('delete_comment_submit_x', null)) {
             pieform(ArtefactTypeComment::delete_comment_form(param_integer('comment')));
         }
     }
     $view = new View($instance->get('view'));
     $submittedgroup = (int) $view->get('submittedgroup');
     if ($USER->is_logged_in() && $submittedgroup && group_user_can_assess_submitted_views($submittedgroup, $USER->get('id'))) {
         $releaseform = true;
     } else {
         $releaseform = false;
     }
     // If the view has comments turned off, tutors can still leave
     // comments if the view is submitted to their group.
     if (!empty($releaseform) || $view->user_comments_allowed($USER)) {
         $addfeedbackpopup = true;
     }
     safe_require('artefact', 'comment');
     $commentoptions = ArtefactTypeComment::get_comment_options();
     $commentoptions->limit = $limit;
     $commentoptions->offset = $offset;
     $commentoptions->showcomment = $showcomment;
     $commentoptions->view = $instance->get_view();
     $feedback = ArtefactTypeComment::get_comments($commentoptions);
     $smarty = smarty_core();
     $smarty->assign('feedback', $feedback);
     if (isset($addfeedbackpopup)) {
         $smarty->assign('enablecomments', 1);
         $smarty->assign('addfeedbackpopup', $addfeedbackpopup);
     }
     $html = $smarty->fetch('blocktype:comment:comment.tpl');
     return $html;
 }
开发者ID:kienv,项目名称:mahara,代码行数:49,代码来源:lib.php


示例6: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     if (!empty($configdata['artefactid'])) {
         safe_require('artefact', 'file');
         safe_require('artefact', 'comment');
         $artefact = $instance->get_artefact_instance($configdata['artefactid']);
         $viewid = $instance->get('view');
         $text = ArtefactTypeFolder::append_view_url($artefact->get('note'), $viewid);
         $information = ArtefactTypeFolder::append_view_url($artefact->get('description'), $viewid);
         $literature = $configdata['literature'];
         $smarty = smarty_core();
         $smarty->assign('text', $text);
         $smarty->assign('information', $information);
         $smarty->assign('literature', $literature);
         $attachments = $artefact->get_attachments();
         if ($attachments) {
             require_once get_config('docroot') . 'artefact/lib.php';
             foreach ($attachments as &$attachment) {
                 $f = artefact_instance_from_id($attachment->id);
                 $attachment->size = $f->describe_size();
                 $attachment->iconpath = $f->get_icon(array('id' => $attachment->id, 'viewid' => isset($options['viewid']) ? $options['viewid'] : 0));
                 $attachment->viewpath = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $attachment->id . '&view=' . (isset($viewid) ? $viewid : 0);
                 $attachment->downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $attachment->id;
                 if (isset($viewid)) {
                     $attachment->downloadpath .= '&view=' . $viewid;
                 }
             }
             $smarty->assign('attachments', $attachments);
             $smarty->assign('count', count($attachments));
         }
         require_once get_config('docroot') . 'lib/view.php';
         $view = new View($viewid);
         list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing);
         $smarty->assign('commentcount', $commentcount);
         $smarty->assign('comments', $comments);
         $smarty->assign('blockid', $instance->get('id'));
         return $smarty->fetch('blocktype:eselmagraduation:content.tpl');
     }
     return '';
 }
开发者ID:vohung96,项目名称:mahara,代码行数:41,代码来源:lib.php


示例7: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     if (!empty($configdata['artefactid'])) {
         safe_require('artefact', 'file');
         safe_require('artefact', 'comment');
         $artefact = $instance->get_artefact_instance($configdata['artefactid']);
         $viewid = $instance->get('view');
         $text = ArtefactTypeFolder::append_view_url($artefact->get('description'), $viewid);
         $smarty = smarty_core();
         $smarty->assign('text', $text);
         $attachments = $artefact->get_attachments();
         if ($attachments) {
             require_once get_config('docroot') . 'artefact/lib.php';
             foreach ($attachments as &$attachment) {
                 $f = artefact_instance_from_id($attachment->id);
                 $attachment->size = $f->describe_size();
                 $attachment->iconpath = $f->get_icon(array('id' => $attachment->id, 'viewid' => isset($options['viewid']) ? $options['viewid'] : 0));
                 $attachment->viewpath = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $attachment->id . '&view=' . (isset($viewid) ? $viewid : 0);
                 $attachment->downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $attachment->id;
                 if (isset($viewid)) {
                     $attachment->downloadpath .= '&view=' . $viewid;
                 }
             }
             $smarty->assign('attachments', $attachments);
             $smarty->assign('count', count($attachments));
         }
         if ($artefact->get('allowcomments')) {
             $commentcount = ArtefactTypeComment::count_comments(null, array($configdata['artefactid']));
             $commentcount = isset($commentcount[$configdata['artefactid']]) ? $commentcount[$configdata['artefactid']]->comments : 0;
             $artefacturl = get_config('wwwroot') . 'artefact/artefact.php?view=' . $viewid . '&artefact=' . $configdata['artefactid'];
             $smarty->assign('artefacturl', $artefacturl);
             $smarty->assign('commentcount', $commentcount);
         }
         return $smarty->fetch('blocktype:textbox:content.tpl');
     }
     return '';
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:38,代码来源:lib.php


示例8: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     $viewid = $instance->get('view');
     $artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
     if (empty($artefactid)) {
         return '';
     }
     $result = self::get_js_source();
     require_once get_config('docroot') . 'artefact/lib.php';
     $artefact = $instance->get_artefact_instance($artefactid);
     $defaultwidth = get_config_plugin('blocktype', 'internalmedia', 'width') ? get_config_plugin('blocktype', 'internalmedia', 'width') : 300;
     $defaultheight = get_config_plugin('blocktype', 'internalmedia', 'height') ? get_config_plugin('blocktype', 'internalmedia', 'height') : 300;
     $width = !empty($configdata['width']) ? hsc($configdata['width']) : $defaultwidth;
     $height = !empty($configdata['height']) ? hsc($configdata['height']) : $defaultheight;
     $mimetype = $artefact->get('filetype');
     $mimetypefiletypes = self::get_allowed_mimetype_filetypes();
     if (!isset($mimetypefiletypes[$mimetype])) {
         return get_string('typeremoved', 'blocktype.file/internalmedia');
     }
     $callbacks = self::get_all_filetype_players();
     $result .= '<div class="mediaplayer-container center"><div class="mediaplayer">' . call_static_method('PluginBlocktypeInternalmedia', $callbacks[$mimetypefiletypes[$mimetype]], $artefact, $instance, $width, $height) . '</div></div>';
     if ($artefactid) {
         require_once get_config('docroot') . 'artefact/comment/lib.php';
         require_once get_config('docroot') . 'lib/view.php';
         $view = new View($viewid);
         list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing);
     }
     $smarty = smarty_core();
     if ($artefactid) {
         $smarty->assign('commentcount', $commentcount);
         $smarty->assign('comments', $comments);
     }
     $smarty->assign('html', $result);
     return $smarty->fetch('blocktype:internalmedia:internalmedia.tpl');
 }
开发者ID:vohung96,项目名称:mahara,代码行数:36,代码来源:lib.php


示例9: define

 *
 * @package    mahara
 * @subpackage artefact-comment
 * @author     Catalyst IT Ltd
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
 * @copyright  For copyright information on Mahara, please see the README file distributed with this software.
 *
 */
define('INTERNAL', 1);
define('MENUITEM', 'myportfolio');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('editcomment', 'artefact.comment'));
safe_require('artefact', 'comment');
$id = param_integer('id');
$viewid = param_integer('view');
$comment = new ArtefactTypeComment($id);
if ($USER->get('id') != $comment->get('author')) {
    throw new AccessDeniedException(get_string('canteditnotauthor', 'artefact.comment'));
}
$onview = $comment->get('onview');
if ($onview && $onview != $viewid) {
    throw new NotFoundException(get_string('commentnotinview', 'artefact.comment', $id, $viewid));
}
$maxage = (int) get_config_plugin('artefact', 'comment', 'commenteditabletime');
$editableafter = time() - 60 * $maxage;
$goto = $comment->get_view_url($viewid, false);
if ($comment->get('ctime') < $editableafter) {
    $SESSION->add_error_msg(get_string('cantedittooold', 'artefact.comment', $maxage));
    redirect($goto);
}
$lastcomment = ArtefactTypeComment::last_public_comment($viewid, $comment->get('onartefact'));
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:edit.php


示例10: create_comment

 /**
  * Creates a comment from the given entry
  *
  * @param SimpleXMLElement $entry    The entry to create the comment from
  * @param PluginImportLeap $importer The importer
  * @return array A list of artefact IDs created, to be used with the artefact mapping.
  */
 private static function create_comment(SimpleXMLElement $entry, PluginImportLeap $importer)
 {
     $createdartefacts = array();
     $comment = new ArtefactTypeComment();
     $comment->set('title', (string) $entry->title);
     $description = PluginImportLeap::get_entry_content($entry, $importer);
     $type = isset($entry->content['type']) ? (string) $entry->content['type'] : 'text';
     if ($type == 'text') {
         $description = format_whitespace($description);
     }
     $comment->set('description', $description);
     if ($published = strtotime((string) $entry->published)) {
         $comment->set('ctime', $published);
     }
     if ($updated = strtotime((string) $entry->updated)) {
         $comment->set('mtime', $updated);
     }
     $private = PluginImportLeap::is_correct_category_scheme($entry, $importer, 'audience', 'Private');
     $comment->set('private', (int) $private);
     $comment->set('owner', $importer->get('usr'));
     if (isset($entry->author->name) && strlen($entry->author->name)) {
         $comment->set('authorname', $entry->author->name);
     } else {
         $comment->set('author', $importer->get('usr'));
     }
     if (empty(self::$tempview)) {
         self::create_temporary_view($importer->get('usr'));
     }
     $comment->set('onview', self::$tempview);
     $comment->set('tags', PluginImportLeap::get_entry_tags($entry));
     $comment->commit();
     array_unshift($createdartefacts, $comment->get('id'));
     return $createdartefacts;
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:41,代码来源:lib.php


示例11: sorttablebycolumn

    $data['ecommenters'] = $extcommenters;
    $data['mcomments'] = $membercomments;
    $data['ecomments'] = $extcomments;
    $data['comments'] = $commenters;
    $data['baseurl'] = $needsubdomain ? $view->get_url(true) : $wwwroot . $view->get_url(false);
}
if (in_array($sort, array('title', 'sharedby', 'mcomments', 'ecomments'))) {
    sorttablebycolumn($sharedviews, $sort, $direction);
}
$sharedviews = array_slice($sharedviews, $offset, $limit);
list($searchform, $groupviews, $unusedpagination) = View::views_by_owner($group->id);
$groupviews = $groupviews->data;
$groupviewscount = count($groupviews);
foreach ($groupviews as &$data) {
    $view = new View($data['id']);
    $comments = ArtefactTypeComment::get_comments(0, 0, null, $view);
    $extcommenters = 0;
    $membercommenters = 0;
    $extcomments = 0;
    $membercomments = 0;
    $commenters = array();
    foreach ($comments->data as $c) {
        if (empty($c->author)) {
            if (!isset($commenters[$c->authorname])) {
                $commenters[$c->authorname] = array();
            }
            $commenters[$c->authorname]['commenter'] = $c->authorname;
            $commenters[$c->authorname]['count'] = isset($commenters[$c->authorname]['count']) ? $commenters[$c->authorname]['count'] + 1 : 1;
            if ($commenters[$c->authorname]['count'] == 1) {
                $extcommenters++;
            }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:report.php


示例12: __construct

 /**
  * @param array $data Parameters:
  *                    - viewid (int)
  *                    - commentid (int)
  */
 public function __construct($data, $cron = false)
 {
     parent::__construct($data, $cron);
     $comment = new ArtefactTypeComment($this->commentid);
     $this->overridemessagecontents = true;
     if ($onartefact = $comment->get('onartefact')) {
         // feedback on artefact
         $userid = null;
         require_once get_config('docroot') . 'artefact/lib.php';
         $artefactinstance = artefact_instance_from_id($onartefact);
         if ($artefactinstance->feedback_notify_owner()) {
             $userid = $artefactinstance->get('owner');
         }
         if (empty($this->url)) {
             $this->url = get_config('wwwroot') . 'view/artefact.php?artefact=' . $onartefact . '&view=' . $this->viewid;
         }
     } else {
         // feedback on view.
         $onview = $comment->get('onview');
         if (!($viewrecord = get_record('view', 'id', $onview))) {
             throw new ViewNotFoundException(get_string('viewnotfound', 'error', $onview));
         }
         $userid = $viewrecord->owner;
         if (empty($this->url)) {
             $this->url = get_config('wwwroot') . 'view/view.php?id=' . $onview;
         }
     }
     if (empty($userid)) {
         return;
     }
     $this->users = activity_get_users($this->get_id(), array($userid));
     $title = $onartefact ? $artefactinstance->get('title') : $viewrecord->title;
     $this->urltext = $title;
     $body = $comment->get('description');
     $posttime = strftime(get_string('strftimedaydatetime'), $comment->get('ctime'));
     $user = $this->users[0];
     $lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
     // Internal
     $this->message = strip_tags(str_shorten_html($body, 200, true));
     // Comment deleted notification
     if ($deletedby = $comment->get('deletedby')) {
         $this->strings = (object) array('subject' => (object) array('key' => 'commentdeletednotificationsubject', 'section' => 'artefact.comment', 'args' => array($title)));
         $deletedmessage = ArtefactTypeComment::deleted_messages();
         $removedbyline = get_string_from_language($lang, $deletedmessage[$deletedby], 'artefact.comment');
         $this->message = $removedbyline . ":\n" . $this->message;
         // Email
         $this->users[0]->htmlmessage = get_string_from_language($lang, 'feedbackdeletedhtml', 'artefact.comment', $title, $removedbyline, $body, $this->url, $title);
         $this->users[0]->emailmessage = get_string_from_language($lang, 'feedbackdeletedtext', 'artefact.comment', $title, $removedbyline, trim(html2text($body)), $title, $this->url);
         return;
     }
     $this->strings = (object) array('subject' => (object) array('key' => 'newfeedbacknotificationsubject', 'section' => 'artefact.comment', 'args' => array($title)));
     $this->url .= '&showcomment=' . $comment->get('id');
     // Email
     $author = $comment->get('author');
     $authorname = empty($author) ? $comment->get('authorname') : display_name($author, $user);
     $this->users[0]->htmlmessage = get_string_from_language($lang, 'feedbacknotificationhtml', 'artefact.comment', $authorname, $title, $posttime, $body, $this->url);
     $this->users[0]->emailmessage = get_string_from_language($lang, 'feedbacknotificationtext', 'artefact.comment', $authorname, $title, $posttime, trim(html2text($body)), $this->url);
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:63,代码来源:lib.php


示例13: define

 * @copyright  For copyright information on Mahara, please see the README file distributed with this software.
 *
 */
define('INTERNAL', 1);
define('PUBLIC', 1);
define('JSON', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once get_config('libroot') . 'view.php';
require_once get_config('libroot') . 'pieforms/pieform.php';
safe_require('artefact', 'comment');
$extradata = json_decode(param_variable('extradata'));
if (!can_view_view($extradata->view)) {
    json_reply('local', get_string('noaccesstoview', 'view'));
}
if (!empty($extradata->artefact) && !artefact_in_view($extradata->artefact, $extradata->view)) {
    json_reply('local', get_string('accessdenied', 'error'));
}
$limit = param_integer('limit', 10);
$offset = param_integer('offset');
$artefact = null;
if (!empty($extradata->artefact)) {
    $artefact = artefact_instance_from_id($extradata->artefact);
}
$view = new View($extradata->view);
$commentoptions = ArtefactTypeComment::get_comment_options();
$commentoptions->limit = $limit;
$commentoptions->offset = $offset;
$commentoptions->view = $view;
$commentoptions->artefact = $artefact;
$data = ArtefactTypeComment::get_comments($commentoptions);
json_reply(false, array('data' => $data));
开发者ID:rboyatt,项目名称:mahara,代码行数:31,代码来源:comments.json.php


示例14: delete

 public function delete()
 {
     safe_require('artefact', 'comment');
     db_begin();
     ArtefactTypeComment::delete_view_comments($this->id);
     delete_records('view_access', 'view', $this->id);
     delete_records('view_autocreate_grouptype', 'view', $this->id);
     delete_records('view_tag', 'view', $this->id);
     delete_records('view_visit', 'view', $this->id);
     delete_records('collection_view', 'view', $this->id);
     delete_records('usr_watchlist_view', 'view', $this->id);
     if ($blockinstanceids = get_column('block_instance', 'id', 'view', $this->id)) {
         require_once get_config('docroot') . 'blocktype/lib.php';
         foreach ($blockinstanceids as $id) {
             $bi = new BlockInstance($id);
             $bi->delete();
         }
     }
     handle_event('deleteview', $this->id);
     delete_records('view_rows_columns', 'view', $this->id);
     delete_records('view', 'id', $this->id);
     if (!empty($this->owner) && $this->is_submitted()) {
         // There should be no way to delete a submitted view,
         // but unlock its artefacts just in case.
         ArtefactType::update_locked($this->owner);
     }
     require_once 'embeddedimage.php';
     EmbeddedImage::delete_embedded_images('description', $this->id);
     $this->deleted = true;
     db_commit();
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:view.php


示例15: array_unshift

        array_unshift($artefactpath, array('url' => get_config('wwwroot') . 'view/artefact.php?artefact=' . $parent . '&view=' . $viewid, 'title' => $parentobj->display_title()));
    }
    $parent = $parentobj->get('parent');
}
$artefactpath[] = array('url' => '', 'title' => $artefact->display_title());
// Feedback
$feedback = ArtefactTypeComment::get_comments($limit, $offset, $showcomment, $view, $artefact);
$javascript = <<<EOF
var viewid = {$viewid};
addLoadEvent(function () {
    paginator = {$feedback->pagination_js}
});
EOF;
if ($artefact->get('allowcomments')) {
    $anonfeedback = !$USER->is_logged_in() && view_has_token($viewid, get_cookie('viewaccess:' . $viewid));
    $addfeedbackform = pieform(ArtefactTypeComment::add_comment_form(false, $artefact->get('approvecomments')));
}
$objectionform = pieform(objection_form());
if ($notrudeform = $view->notrude_form()) {
    $notrudeform = pieform($notrudeform);
}
$viewbeingwatched = (int) record_exists('usr_watchlist_view', 'usr', $USER->get('id'), 'view', $viewid);
$headers = array('<link rel="stylesheet" type="text/css" href="' . get_config('wwwroot') . 'theme/views.css">');
$hasfeed = false;
$feedlink = '';
// add a link to the ATOM feed in the header if the view is public
if ($artefact->get('artefacttype') == 'blog' && $view->is_public()) {
    $hasfeed = true;
    $feedlink = get_config('wwwroot') . 'artefact/blog/atom.php?artefact=' . $artefactid . '&view=' . $viewid;
    $headers[] = '<link rel="alternate" type="application/atom+xml" href="' . $feedlink . '" />';
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:31,代码来源:artefact.php


示例16: isset

}
// If the view has comments turned off, tutors can still leave
// comments if the view is submitted to their group.
if (!empty($releaseform) || ($commenttype = $view->user_comments_allowed($USER))) {
    $defaultprivate = !empty($releaseform);
    $moderate = isset($commenttype) && $commenttype === 'private';
    $addfeedbackform = pieform(ArtefactTypeComment::add_comment_form($defaultprivate, $moderate));
}
if ($USER->is_logged_in()) {
    $objectionform = pieform(objection_form());
    if ($notrudeform = $view->notrude_form()) {
        $notrudeform = pieform($notrudeform);
    }
}
$viewbeingwatched = (int) record_exists('usr_watchlist_view', 'usr', $USER->get('id'), 'view', $viewid);
$feedback = ArtefactTypeComment::get_comments($limit, $offset, $showcomment, $view);
// Set up theme
$viewtheme = $view->get('theme');
if ($viewtheme && $THEME->basename != $viewtheme) {
    $THEME = new Theme($viewtheme);
}
$stylesheets = array('<link rel="stylesheet" type="text/css" href="' . get_config('wwwroot') . 'theme/views.css">');
$can_edit = $USER->can_edit_view($view) && !$submittedgroup && !$view->is_submitted();
$smarty = smarty(array('paginator', 'viewmenu', 'artefact/resume/resumeshowhide.js'), $stylesheets, array(), array('stylesheets' => array('style/views.css'), 'sidebars' => false));
$javascript = <<<EOF
var viewid = {$viewid};
addLoadEvent(function () {
    paginator = {$feedback->pagination_js}
});
EOF;
// collection top navigation
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:31,代码来源:view.php


示例17: institution_view_stats_table

function institution_view_stats_table($limit, $offset, &$institutiondata)
{
    global $USER;
    if ($institutiondata['views'] != 0) {
        $count = count_records_select('view', 'id IN (' . join(',', array_fill(0, $institutiondata['views'], '?')) . ') AND type != ?', array_merge($institutiondata['viewids'], array('dashboard')));
    } else {
        $count = 0;
    }
    $pagination = build_pagination(array('id' => 'stats_pagination', 'url' => get_config('wwwroot') . 'admin/users/statistics.php?institution=' . $institutiondata['name'] . '&type=views', 'jsonscript' => 'admin/users/statistics.json.php', 'datatable' => 'statistics_table', 'count' => $count, 'limit' => $limit, 'offset' => $offset, 'extradata' => array('institution' => $institutiondata['name']), 'setlimit' => true));
    $result = array('count' => $count, 'tablerows' => '', 'pagination' => $pagination['html'], 'pagination_js' => $pagination['javascript']);
    if ($count < 1) {
        return $result;
    }
    $viewdata = get_records_sql_assoc("SELECT\n            v.id, v.title, v.owner, v.group, v.institution, v.visits, v.type, v.ownerformat, v.urlid\n        FROM {view} v\n        WHERE v.id IN (" . join(',', array_fill(0, $institutiondata['views'], '?')) . ") AND v.type != ?\n        ORDER BY v.visits DESC, v.title, v.id", array_merge($institutiondata['viewids'], array('dashboard')), $offset, $limit);
    require_once 'view.php';
    require_once 'group.php';
    View::get_extra_view_info($viewdata, false, false);
    safe_require('artefact', 'comment');
    $comments = ArtefactTypeComment::count_comments(array_keys($viewdata));
    foreach ($viewdata as &$v) {
        $v = (object) $v;
        if ($v->owner) {
            $v->ownername = display_name($v->user);
            $v->ownerurl = profile_url($v->user);
        } else {
            $v->ownername = $v->sharedby;
            if ($v->group) {
                $v->ownerurl = group_homepage_url($v->groupdata);
            } else {
                if ($v->institution && $v->institution != 'mahara') {
                    $v->ownerurl = get_config('wwwroot') . 'institution/index.php?institution=' . $v->institution;
                }
            }
        }
        $v->comments = isset($comments[$v->id]) ? (int) $comments[$v->id]->comments : 0;
    }
    $csvfields = array('title', 'displaytitle', 'fullurl', 'owner', 'group', 'institution', 'ownername', 'ownerurl', 'visits', 'type', 'comments');
    $USER->set_download_file(generate_csv($viewdata, $csvfields), 'viewstatistics.csv', 'text/csv');
    $result['csv'] = true;
    $smarty = smarty_core();
    $smarty->assign('data', $viewdata);
    $smarty->assign('offset', $offset);
    $result['tablerows'] = $smarty->fetch('admin/viewstats.tpl');
    return $result;
}
开发者ID:kienv,项目名称:mahara,代码行数:45,代码来源:registration.php


示例18: setup_view_relationships_from_request

 /**
  * Fix comments to point to the right view.  Probably more
  * appropriate in setup_relationships.  To do that we would have
  * to change that call to happen after views are created.
  */
 public static function setup_view_relationships_from_request(PluginImportLeap $importer)
 {
     if ($entry_requests = get_records_select_array('import_entry_requests', 'importid = ? AND entrytype = ?', array($importer->get('importertransport')->get('importid'), 'comment'))) {
         foreach ($entry_requests as $entry_request) {
             $commentids = unserialize($entry_request->artefactmapping);
             $comment = new ArtefactTypeComment($commentids[0]);
             if ($comment->get('onartefact')) {
                 continue;
             }
             $entry = $importer->get_entry_by_id($entry_request->entryid);
             $referentid = self::get_referent_entryid($entry, $importer);
             if ($viewid = $importer->get_viewid_imported_by_entryid($referentid)) {
                 $comment->set('onview', $viewid);
                 $comment->commit();
             } else {
                 // Nothing to link this comment to, so leave it in the temporary view.
                 self::$savetempview = true;
             }
         }
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:26,代码来源:lib.php


示例19: institution_submit

function institution_submit(Pieform $form, $values)
{
    global $SESSION, $institution, $add, $instancearray, $USER, $authinstances, $customthemedefaults;
    db_begin();
    // Update the basic institution record...
    if ($add) {
        $newinstitution = new Institution();
        $newinstitution->initialise($values['name'], $values['displayname']);
        $institution = $newinstitution->name;
    } else {
        $newinstitution = new Institution($institution);
        $newinstitution->displayname = $values['displayname'];
        $oldinstitution = get_record('institution', 'name', $institution);
        // Clear out any cached menus for this institution
        clear_menu_cache($institution);
    }
    $newinstitution->showonlineusers = !isset($values['showonlineusers']) ? 2 : $values['showonlineusers'];
    if (get_config('usersuniquebyusername')) {
        // Registering absolutely not allowed when this setting is on, it's a
        // security risk. See the documentation for the usersuniquebyusername
        // setting for more information
        $newinstitution->registerallowed = 0;
    } else {
        $newinstitution->registerallowed = $values['registerallowed'] ? 1 : 0;
        $newinstitution->registerconfirm = $values['registerconfirm'] ? 1 : 0;
    }
    if (!empty($values['lang'])) {
        if ($values['lang'] == 'sitedefault') {
            $newinstitution->lang = null;
        } else {
            $newinstitution->lang = $values['lang'];
        }
    }
    $newinstitution->theme = empty($values['theme']) || $values['theme'] == 'sitedefault' ? null : $values['theme'];
    $newinstitution->dropdownmenu = !empty($values['dropdownmenu']) ? 1 : 0;
    $newinstitution->skins = !empty($values['skins']) ? 1 : 0;
    require_once get_config('docroot') . 'artefact/comment/lib.php';
    $commentoptions = ArtefactTypeComment::get_comment_options();
    $newinstitution->commentsortorder = empty($values['commentsortorder']) ? $commentoptions->sort : $values['commentsortorder'];
    $newinstitution->commentthreaded = !empty($values['commentthreaded']) ? 1 : 0;
    if ($newinstitution->theme == 'custom') {
        if (!empty($oldinstitution->style)) {
            $styleid = $oldinstitution->style;
            delete_records('style_property', 'style', $styleid);
        } else {
            $record = (object) array('title' => get_string('customstylesforinstitution', 'admin', $newinstitution->displayname));
            $styleid = insert_record('style', $record, 'id', true);
        }
        $properties = array();
        $record = (object) array('style' => $styleid);
        foreach (array_keys($customthemedefaults) as $name) {
            $record->field = $name;
            $record->value = $values[$name];
            insert_record('style_property', $record);
            $properties[$name] = $values[$name];
        }
        // Cache the css
        $smarty = smarty_core();
        $smarty->assign('data', $properties);
        set_field('style', 'css', $smarty->fetch('customcss.tpl'), 'id', $styleid);
        $newinstitution->style = $styleid;
    } else {
        $newinstitution->style = null;
    }
    if (get_config('licensemetadata')) {
        $newinstitution->licensemandatory = !empty($values['licensemandatory']) ? 1 : 0;
        $newinstitution->licensedefault = isset($values['licensedefault']) ? $values['licensedefault'] : '';
    }
    if (!empty($values['resetcustom']) && !empty($oldinstitution->style)) {
        $newinstitution->style = null;
    }
    if ($USER->get('admin') || get_config_plugin('artefact', 'file', 'institutionaloverride')) {
        if (!empty($values['updateuserquotas']) && !empty($values['defaultquota'])) {
            execute_sql("UPDATE {usr} SET quota = ? WHERE id IN (SELECT usr FROM {usr_institution} WHERE institution = ?)", array($values['defaultquota'], $institution));
            // get all the users from the institution and make sure that they are still below
            // their quota threshold
            if ($users = get_records_sql_array('SELECT * FROM {usr} u LEFT JOIN {usr_institution} ui ON u.id = ui.usr AND ui.institution = ?', array($institution))) {
                $quotanotifylimit = get_config_plugin('artefact', 'file', 'quotanotifylimit');
                if ($quotanotifylimit <= 0 || $quotanotifylimit >= 100) {
                    $quotanotifylimit = 100;
                }
                foreach ($users as $user) {
                    $user->quota = $values['defaultquota'];
                    // check if the user has gone over the quota notify limit
                    $user->quotausedpercent = $user->quota 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ArtefactTypeFileBase类代码示例发布时间:2022-05-23
下一篇:
PHP ArtefactType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap