Exemplo n.º 1
0
if ($blogobj->get('institution')) {
    $institution = true;
    $institutionname = $blogobj->get('institution');
} else {
    if ($blogobj->get('group')) {
        $groupid = $blogobj->get('group');
    }
}
PluginArtefactBlog::set_blog_nav($institution, $institutionname, $groupid);
$folder = param_integer('folder', 0);
$browse = (int) param_variable('browse', 0);
$highlight = null;
if ($file = param_integer('file', 0)) {
    $highlight = array($file);
}
$form = pieform(array('name' => 'editpost', 'method' => 'post', 'autofocus' => $focuselement, 'jsform' => true, 'newiframeonsubmit' => true, 'jssuccesscallback' => 'editpost_callback', 'jserrorcallback' => 'editpost_callback', 'plugintype' => 'artefact', 'pluginname' => 'blog', 'configdirs' => array(get_config('libroot') . 'form/', get_config('docroot') . 'artefact/file/form/'), 'elements' => array('blog' => array('type' => 'hidden', 'value' => $blog), 'blogpost' => array('type' => 'hidden', 'value' => $blogpost), 'title' => array('type' => 'text', 'title' => get_string('posttitle', 'artefact.blog'), 'rules' => array('required' => true), 'defaultvalue' => $title), 'description' => array('type' => 'wysiwyg', 'rows' => 20, 'cols' => 70, 'title' => get_string('postbody', 'artefact.blog'), 'description' => get_string('postbodydesc', 'artefact.blog'), 'rules' => array('maxlength' => 65536, 'required' => true), 'defaultvalue' => $description), 'tags' => array('defaultvalue' => $tags, 'type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdesc'), 'help' => true), 'license' => license_form_el_basic(isset($blogpostobj) ? $blogpostobj : null), 'licensing_advanced' => license_form_el_advanced(isset($blogpostobj) ? $blogpostobj : null), 'filebrowser' => array('type' => 'filebrowser', 'title' => get_string('attachments', 'artefact.blog'), 'folder' => $folder, 'highlight' => $highlight, 'institution' => $institutionname, 'group' => $groupid, 'browse' => $browse, 'page' => get_config('wwwroot') . 'artefact/blog/post.php?' . ($blogpost ? 'id=' . $blogpost : 'blog=' . $blog) . '&browse=1', 'browsehelp' => 'browsemyfiles', 'config' => array('upload' => true, 'uploadagreement' => get_config_plugin('artefact', 'file', 'uploadagreement'), 'resizeonuploaduseroption' => get_config_plugin('artefact', 'file', 'resizeonuploaduseroption'), 'resizeonuploaduserdefault' => $USER->get_account_preference('resizeonuploaduserdefault'), 'createfolder' => false, 'edit' => false, 'select' => true), 'defaultvalue' => $attachments, 'selectlistcallback' => 'artefact_get_records_by_id', 'selectcallback' => 'add_attachment', 'unselectcallback' => 'delete_attachment'), 'draft' => array('type' => 'switchbox', 'title' => get_string('draft', 'artefact.blog'), 'description' => get_string('thisisdraftdesc', 'artefact.blog'), 'defaultvalue' => $checked, 'help' => true), 'allowcomments' => array('type' => 'switchbox', 'title' => get_string('allowcomments', 'artefact.comment'), 'description' => get_string('allowcommentsonpost', 'artefact.blog'), 'defaultvalue' => $blogpost ? $blogpostobj->get('allowcomments') : 1), 'submitpost' => array('type' => 'submitcancel', 'class' => 'btn-primary', 'value' => array(get_string('savepost', 'artefact.blog'), get_string('cancel')), 'goto' => get_config('wwwroot') . 'artefact/blog/view/index.php?id=' . $blog))));
/*
 * Javascript specific to this page.  Creates the list of files
 * attached to the blog post.
 */
$wwwroot = get_config('wwwroot');
$noimagesmessage = json_encode(get_string('noimageshavebeenattachedtothispost', 'artefact.blog'));
$javascript = <<<EOF
function editpost_callback(form, data) {
    editpost_filebrowser.callback(form, data);
};
EOF;
$smarty = smarty(array(), array(), array(), array('tinymceconfig' => '
        image_filebrowser: "editpost_filebrowser",
    ', 'sideblocks' => array(array('name' => 'quota', 'weight' => -10, 'data' => array()))));
$smarty->assign('INLINEJAVASCRIPT', $javascript);
Exemplo n.º 2
0
 public static function instance_config_form(BlockInstance $instance)
 {
     global $USER;
     require_once 'license.php';
     safe_require('artefact', 'file');
     $instance->set('artefactplugin', 'internal');
     $configdata = $instance->get('configdata');
     if (!($height = get_config('blockeditorheight'))) {
         $cfheight = param_integer('cfheight', 0);
         $height = $cfheight ? $cfheight * 0.7 : 150;
     }
     $otherblockcount = 0;
     $readonly = false;
     $text = '';
     $tags = '';
     $view = $instance->get_view();
     if (!empty($configdata['artefactid'])) {
         $artefactid = $configdata['artefactid'];
         try {
             $artefact = $instance->get_artefact_instance($artefactid);
             $readonly = $artefact->get('owner') !== $view->get('owner') || $artefact->get('group') !== $view->get('group') || $artefact->get('institution') !== $view->get('institution') || $artefact->get('locked') || !$USER->can_edit_artefact($artefact);
             $text = $artefact->get('description');
             $tags = $artefact->get('tags');
             if ($blocks = get_column('view_artefact', 'block', 'artefact', $artefactid)) {
                 $blocks = array_unique($blocks);
                 $otherblockcount = count($blocks) - 1;
             }
         } catch (ArtefactNotFoundException $e) {
             unset($artefactid);
         }
     }
     $otherblocksmsg = '<span id="textbox_blockcount">' . $otherblockcount . '</span>';
     $otherblocksmsg = get_string('textusedinotherblocks', 'blocktype.internal/textbox', $otherblocksmsg);
     $manageurl = get_config('wwwroot') . 'artefact/internal/notes.php';
     if ($group = $view->get('group')) {
         $manageurl .= '?group=' . $group;
     } else {
         if ($institution = $view->get('institution')) {
             $manageurl .= '?institution=' . $institution;
         }
     }
     // Update the attached files in block configdata as
     // it may change when attached files have been deleted
     $attachmentids = isset($artefact) ? $artefact->attachment_id_list() : false;
     if ($attachmentids !== false && isset($configdata['artefactids']) && $configdata['artefactids'] != $attachmentids) {
         $configdata['artefactids'] = $attachmentids;
         $instance->set('configdata', $configdata);
         $instance->commit();
     }
     $elements = array('otherblocksmsg' => array('type' => 'html', 'class' => 'message info' . ($otherblockcount && !$readonly ? '' : ' hidden'), 'value' => '<p class="alert alert-info">' . $otherblocksmsg . ' <a class="copytextboxnote nojs-hidden-inline" href="">' . get_string('makeacopy', 'blocktype.internal/textbox') . '</a></p>', 'help' => true), 'readonlymsg' => array('type' => 'html', 'class' => 'message info' . ($readonly ? '' : ' hidden'), 'value' => '<p class="alert alert-info">' . get_string('readonlymessage', 'blocktype.internal/textbox') . ' <a class="copytextboxnote nojs-hidden-inline" href="">' . get_string('makeacopy', 'blocktype.internal/textbox') . '</a></p>', 'help' => true), 'text' => array('type' => 'wysiwyg', 'class' => $readonly ? 'hidden' : '', 'title' => get_string('blockcontent', 'blocktype.internal/textbox'), 'width' => '100%', 'height' => $height . 'px', 'defaultvalue' => $text, 'rules' => array('maxlength' => 65536)), 'textreadonly' => array('type' => 'html', 'class' => $readonly ? '' : 'hidden', 'title' => get_string('blockcontent', 'blocktype.internal/textbox'), 'value' => '<div id="instconf_textreadonly_display" class="well text-midtone">' . $text . '</div>'), 'makecopy' => array('type' => 'checkbox', 'class' => 'hidden', 'defaultvalue' => false), 'chooseartefact' => array('type' => 'html', 'value' => '<a id="chooseartefactlink" href="#" class="btn btn-default">' . get_string('usecontentfromanothertextbox1', 'blocktype.internal/textbox') . '</a>'), 'managenotes' => array('type' => 'html', 'class' => 'hidden text-right', 'value' => '<a href="' . $manageurl . '" target="_blank" class="pull-right">' . get_string('managealltextboxcontent1', 'blocktype.internal/textbox') . ' <span class="icon icon-arrow-right right"></span></a>'), 'artefactid' => self::artefactchooser_element(isset($artefactid) ? $artefactid : null), 'license' => license_form_el_basic(isset($artefact) ? $artefact : null), 'license_advanced' => license_form_el_advanced(isset($artefact) ? $artefact : null), 'licensereadonly' => array('type' => 'html', 'class' => $readonly ? '' : 'hidden', 'title' => get_string('license'), 'value' => '<div id="instconf_licensereadonly_display">' . (isset($artefact) ? render_license($artefact) : get_string('licensenone')) . '</div>'), 'allowcomments' => array('type' => 'switchbox', 'title' => get_string('allowcomments', 'artefact.comment'), 'defaultvalue' => !empty($artefact) ? $artefact->get('allowcomments') : 1), 'tags' => array('type' => 'tags', 'class' => $readonly ? 'hidden' : '', 'title' => get_string('tags'), 'description' => get_string('tagsdescprofile'), 'defaultvalue' => $tags), 'tagsreadonly' => array('type' => 'html', 'class' => $readonly ? '' : 'hidden', 'title' => get_string('tags'), 'value' => '<div id="instconf_tagsreadonly_display">' . (is_array($tags) ? hsc(join(', ', $tags)) : '') . '</div>'), 'artefactfieldset' => array('type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('attachments', 'artefact.blog'), 'class' => 'last with-formgroup', 'elements' => array('artefactids' => self::filebrowser_element($instance, isset($configdata['artefactids']) ? $configdata['artefactids'] : null))));
     if ($readonly) {
         $elements['license']['class'] = 'hidden';
         $elements['license_advanced']['class'] = 'hidden';
     }
     return $elements;
 }
Exemplo n.º 3
0
 public static function add_comment_form($defaultprivate = false, $moderate = false)
 {
     global $USER;
     $form = array('name' => 'add_feedback_form', 'method' => 'post', 'class' => 'js-hidden', 'plugintype' => 'artefact', 'pluginname' => 'comment', 'jsform' => true, 'autofocus' => false, 'elements' => array(), 'jssuccesscallback' => 'addFeedbackSuccess');
     if (!$USER->is_logged_in()) {
         $form['spam'] = array('secret' => get_config('formsecret'), 'mintime' => 1, 'hash' => array('authorname', 'message', 'ispublic', 'message', 'submit'));
         $form['elements']['authorname'] = array('type' => 'text', 'title' => get_string('name'), 'rules' => array('required' => true));
     }
     $form['elements']['message'] = array('type' => 'wysiwyg', 'title' => get_string('message'), 'rows' => 5, 'cols' => 80, 'rules' => array('maxlength' => 8192));
     if (get_config_plugin('artefact', 'comment', 'commentratings')) {
         $form['elements']['rating'] = array('type' => 'radio', 'title' => get_string('rating', 'artefact.comment'), 'options' => array('1' => '', '2' => '', '3' => '', '4' => '', '5' => ''), 'class' => 'star');
     }
     $form['elements']['ispublic'] = array('type' => 'checkbox', 'title' => get_string('makepublic', 'artefact.comment'), 'defaultvalue' => !$defaultprivate);
     if (get_config('licensemetadata')) {
         $form['elements']['license'] = license_form_el_basic(null);
         $form['elements']['licensing_advanced'] = license_form_el_advanced(null);
     }
     if ($moderate) {
         $form['elements']['ispublic']['description'] = get_string('approvalrequired', 'artefact.comment');
         $form['elements']['moderate'] = array('type' => 'hidden', 'value' => true);
     }
     if ($USER->is_logged_in()) {
         $form['elements']['attachments'] = array('type' => 'files', 'title' => get_string('attachfile', 'artefact.comment'), 'defaultvalue' => array(), 'maxfilesize' => get_max_upload_size(false));
     }
     $form['elements']['submit'] = array('type' => 'submitcancel', 'value' => array(get_string('placefeedback', 'artefact.comment'), get_string('cancel')));
     return $form;
 }
Exemplo n.º 4
0
/**
 * Given an artefact object, return the form already rendered.
 *
 * @param object   The artefact
 * @return string  HTML containing <tr> tags at the top level.
 */
function license_form_files($prefix, $prefix2 = null)
{
    if (!get_config('licensemetadata')) {
        return '';
    }
    require_once 'pieforms/pieform.php';
    if ($prefix2 !== null) {
        $prefix .= '_' . $prefix2;
    }
    $form = array('name' => $prefix, 'plugintype' => 'artefact', 'pluginname' => 'file', 'elements' => array($prefix . '_license' => license_form_el_basic(null), 'license_advanced' => license_form_el_advanced(null, $prefix . '_')));
    $pie = new Pieform($form);
    $pie->build();
    $rendered = $pie->get_property('elements');
    if (empty($form['elements'][$prefix . '_license']['rules']['required'])) {
        $rowattr = '';
    } else {
        $rowattr = 'class="required"';
    }
    $html = '';
    foreach (array($rendered[$prefix . '_license'], $rendered['license_advanced']['elements'][$prefix . '_licensor'], $rendered['license_advanced']['elements'][$prefix . '_licensorurl']) as $e) {
        $helphtml = preg_replace('/files_filebrowser_(edit_)?licens/', 'licens', $e['helphtml']);
        $html .= '<div class="form-group">' . $rowattr . '' . $e['labelhtml'] . '' . '' . $e['html'] . $helphtml . '</div>';
        $rowattr = '';
    }
    $html = str_replace('id="' . $prefix . '_' . $prefix . '_', 'id="' . $prefix . '_', $html);
    $html = str_replace('for="' . $prefix . '_' . $prefix . '_', 'for="' . $prefix . '_', $html);
    return $html;
}
Exemplo n.º 5
0
$lastcomment = ArtefactTypeComment::last_public_comment($viewid, $comment->get('onartefact'));
if (!$comment->get('private') && $id != $lastcomment->id) {
    $SESSION->add_error_msg(get_string('cantedithasreplies', 'artefact.comment'));
    redirect($goto);
}
$elements = array();
$elements['message'] = array('type' => 'wysiwyg', 'title' => get_string('message'), 'rows' => 5, 'cols' => 80, 'defaultvalue' => $comment->get('description'), 'rules' => array('maxlength' => 8192));
if (get_config_plugin('artefact', 'comment', 'commentratings')) {
    $elements['rating'] = array('type' => 'radio', 'title' => get_string('rating', 'artefact.comment'), 'options' => array('1' => '', '2' => '', '3' => '', '4' => '', '5' => ''), 'class' => 'star', 'defaultvalue' => $comment->get('rating'));
} else {
    $elements['rating'] = array('type' => 'hidden', 'value' => $comment->get('rating'));
}
$elements['ispublic'] = array('type' => 'checkbox', 'title' => get_string('makepublic', 'artefact.comment'), 'defaultvalue' => !$comment->get('private'));
if (get_config('licensemetadata')) {
    $elements['license'] = license_form_el_basic($comment);
    $elements['licensing_advanced'] = license_form_el_advanced($comment);
}
$elements['submit'] = array('type' => 'submitcancel', 'value' => array(get_string('save'), get_string('cancel')), 'goto' => $goto);
$form = pieform(array('name' => 'edit_comment', 'method' => 'post', 'plugintype' => 'artefact', 'pluginname' => 'comment', 'elements' => $elements));
function edit_comment_validate(Pieform $form, $values)
{
    require_once get_config('libroot.php') . 'antispam.php';
    $result = probation_validate_content($values['message']);
    if ($result !== true) {
        $form->set_error('message', get_string('newuserscantpostlinksorimages'));
    }
}
function edit_comment_submit(Pieform $form, $values)
{
    global $viewid, $comment, $SESSION, $goto, $USER;
    db_begin();
Exemplo n.º 6
0
Arquivo: lib.php Projeto: kienv/mahara
 public static function add_comment_form($defaultprivate = false, $moderate = false)
 {
     global $USER;
     $form = array('name' => 'add_feedback_form', 'method' => 'post', 'plugintype' => 'artefact', 'pluginname' => 'comment', 'jsform' => true, 'autofocus' => false, 'elements' => array(), 'jssuccesscallback' => 'addFeedbackSuccess', 'jserrorcallback' => 'addFeedbackError');
     if (!$USER->is_logged_in()) {
         $form['spam'] = array('secret' => get_config('formsecret'), 'mintime' => 1, 'hash' => array('authorname', 'message', 'message', 'submit'));
         $form['elements']['authorname'] = array('type' => 'text', 'title' => get_string('name'), 'rules' => array('required' => true));
     }
     $form['elements']['message'] = array('type' => 'wysiwyg', 'title' => get_string('message'), 'class' => 'hide-label', 'rows' => 5, 'cols' => 80, 'rules' => array('maxlength' => 8192));
     if (get_config_plugin('artefact', 'comment', 'commentratings')) {
         $form['elements']['rating'] = array('type' => 'radio', 'title' => get_string('rating', 'artefact.comment'), 'options' => array('1' => '', '2' => '', '3' => '', '4' => '', '5' => ''), 'class' => 'star');
     }
     $form['elements']['ispublic'] = array('type' => 'switchbox', 'title' => get_string('makepublic', 'artefact.comment'), 'defaultvalue' => !$defaultprivate);
     if (get_config('licensemetadata')) {
         $form['elements']['license'] = license_form_el_basic(null);
         $form['elements']['licensing_advanced'] = license_form_el_advanced(null);
     }
     if ($moderate) {
         $form['elements']['ispublic']['description'] = get_string('approvalrequired', 'artefact.comment');
         $form['elements']['moderate'] = array('type' => 'hidden', 'value' => true);
     }
     if ($USER->is_logged_in()) {
         $form['elements']['attachments'] = array('type' => 'files', 'title' => get_string('attachfile', 'artefact.comment'), 'defaultvalue' => array(), 'maxfilesize' => get_max_upload_size(false));
     }
     $form['elements']['submit'] = array('type' => 'submitcancel', 'class' => 'btn-default', 'value' => array(get_string('Comment', 'artefact.comment'), get_string('cancel')));
     // This is a placeholder where we can display the parent comment's text
     // And also the strings we display when we are forcing a reply to be public or private
     $snippet = smarty_core();
     $form['elements']['replytoview'] = array('type' => 'html', 'value' => $snippet->fetch('artefact:comment:replyplaceholder.tpl'));
     // This is a placeholder for the parent comment's ID. It'll be populated by Javascript if needed.
     $form['elements']['replyto'] = array('type' => 'hidden', 'dynamic' => 'true', 'value' => null);
     return $form;
 }
Exemplo n.º 7
0
 * @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', 'content/blogs');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'blog');
define('SECTION_PAGE', 'new');
require dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php';
define('TITLE', get_string('newblog', 'artefact.blog') . ': ' . get_string('blogsettings', 'artefact.blog'));
require_once 'license.php';
require_once 'pieforms/pieform.php';
safe_require('artefact', 'blog');
$form = pieform(array('name' => 'newblog', 'method' => 'post', 'action' => '', 'plugintype' => 'artefact', 'pluginname' => 'blog', 'elements' => array('title' => array('type' => 'text', 'title' => get_string('blogtitle', 'artefact.blog'), 'description' => get_string('blogtitledesc', 'artefact.blog'), 'rules' => array('required' => true)), 'description' => array('type' => 'wysiwyg', 'rows' => 10, 'cols' => 70, 'title' => get_string('blogdesc', 'artefact.blog'), 'description' => get_string('blogdescdesc', 'artefact.blog'), 'rules' => array('maxlength' => 65536, 'required' => false)), 'tags' => array('type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdescprofile'), 'help' => true), 'license' => license_form_el_basic(null), 'licensing_advanced' => license_form_el_advanced(null), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('createblog', 'artefact.blog'), get_string('cancel', 'artefact.blog'))))));
$smarty =& smarty();
$smarty->assign_by_ref('form', $form);
$smarty->assign('PAGEHEADING', TITLE);
$smarty->display('form.tpl');
exit;
/**
 * This function gets called to submit the new blog.
 *
 * @param array
 */
function newblog_submit(Pieform $form, $values)
{
    global $USER;
    ArtefactTypeBlog::new_blog($USER, $values);
    redirect('/artefact/blog/index.php');
Exemplo n.º 8
0
 /**
  * Gets the new/edit fields for the tasks pieform
  *
  */
 public static function get_taskform_elements($parent, $task = null)
 {
     $elements = array('title' => array('type' => 'text', 'defaultvalue' => null, 'title' => get_string('title', 'artefact.plans'), 'description' => get_string('titledesc', 'artefact.plans'), 'size' => 30, 'rules' => array('required' => true)), 'completiondate' => array('type' => 'calendar', 'caloptions' => array('showsTime' => false, 'ifFormat' => '%Y/%m/%d', 'dateFormat' => 'yy/mm/dd'), 'defaultvalue' => null, 'title' => get_string('completiondate', 'artefact.plans'), 'description' => get_string('dateformatguide'), 'rules' => array('required' => true)), 'description' => array('type' => 'textarea', 'rows' => 10, 'cols' => 50, 'resizable' => false, 'defaultvalue' => null, 'title' => get_string('description', 'artefact.plans')), 'tags' => array('type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdescprofile')), 'completed' => array('type' => 'checkbox', 'defaultvalue' => null, 'title' => get_string('completed', 'artefact.plans'), 'description' => get_string('completeddesc', 'artefact.plans')));
     if (!empty($task)) {
         foreach ($elements as $k => $element) {
             $elements[$k]['defaultvalue'] = $task->get($k);
         }
         $elements['task'] = array('type' => 'hidden', 'value' => $task->id);
     }
     if (get_config('licensemetadata')) {
         $elements['license'] = license_form_el_basic($task);
         $elements['license_advanced'] = license_form_el_advanced($task);
     }
     $elements['parent'] = array('type' => 'hidden', 'value' => $parent);
     return $elements;
 }
Exemplo n.º 9
0
$blog = new ArtefactTypeBlog($id);
$institution = $institutionname = $groupid = null;
if ($blog->get('institution')) {
    $institution = true;
    $institutionname = $blog->get('institution');
} else {
    if ($blog->get('group')) {
        $groupid = $blog->get('group');
    }
}
PluginArtefactBlog::set_blog_nav($institution, $institutionname, $groupid);
$blog->check_permission(true);
if ($blog->get('locked')) {
    throw new AccessDeniedException(get_string('submittedforassessment', 'view'));
}
$form = pieform(array('name' => 'editblog', 'method' => 'post', 'action' => '', 'plugintype' => 'artefact', 'pluginname' => 'blog', 'elements' => array('id' => array('type' => 'hidden', 'value' => $id), 'institution' => array('type' => 'hidden', 'value' => $institutionname ? $institutionname : 0), 'group' => array('type' => 'hidden', 'value' => $groupid ? $groupid : 0), 'title' => array('type' => 'text', 'title' => get_string('blogtitle', 'artefact.blog'), 'description' => get_string('blogtitledesc', 'artefact.blog'), 'rules' => array('required' => true), 'defaultvalue' => $blog->get('title')), 'description' => array('type' => 'wysiwyg', 'rows' => 10, 'cols' => 70, 'title' => get_string('blogdesc', 'artefact.blog'), 'description' => get_string('blogdescdesc', 'artefact.blog'), 'rules' => array('maxlength' => 65536, 'required' => false), 'defaultvalue' => $blog->get('description')), 'tags' => array('defaultvalue' => $blog->get('tags'), 'type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdescprofile'), 'help' => true), 'license' => license_form_el_basic($blog), 'licensing_advanced' => license_form_el_advanced($blog), 'submit' => array('type' => 'submitcancel', 'class' => 'btn-primary', 'value' => array(get_string('savesettings', 'artefact.blog'), get_string('cancel', 'artefact.blog'))))));
$smarty = smarty();
if (!$institutionname && !$groupid) {
    if (!$USER->get_account_preference('multipleblogs') && count_records('artefact', 'artefacttype', 'blog', 'owner', $USER->get('id')) == 1) {
        $smarty->assign('enablemultipleblogstext', 1);
    }
}
$smarty->assign_by_ref('editform', $form);
$smarty->assign_by_ref('blog', $blog);
$smarty->assign('PAGEHEADING', TITLE);
$smarty->display('artefact:blog:settings.tpl');
exit;
/**
 * This function is called to update the blog details.
 */
function editblog_submit(Pieform $form, $values)
Exemplo n.º 10
0
} else {
    if ($institution = $artefact->get('institution')) {
        define('INSTITUTIONALADMIN', 1);
        define('MENUITEM', 'manageinstitutions');
        $goto .= '?institution=' . $institution;
    } else {
        define('MENUITEM', 'content/notes');
    }
}
$folder = param_integer('folder', 0);
$browse = (int) param_variable('browse', 0);
$highlight = null;
if ($file = param_integer('file', 0)) {
    $highlight = array($file);
}
$form = array('name' => 'editnote', 'method' => 'post', 'jsform' => true, 'newiframeonsubmit' => true, 'jssuccesscallback' => 'editnote_callback', 'jserrorcallback' => 'editnote_callback', 'plugintype' => 'artefact', 'pluginname' => 'internal', 'configdirs' => array(get_config('libroot') . 'form/', get_config('docroot') . 'artefact/file/form/'), 'elements' => array('title' => array('type' => 'text', 'title' => get_string('Title', 'artefact.internal'), 'defaultvalue' => $artefact->get('title')), 'description' => array('type' => 'wysiwyg', 'title' => get_string('Note', 'artefact.internal'), 'rows' => 10, 'cols' => 70, 'defaultvalue' => $artefact->get('description')), 'tags' => array('type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdescprofile'), 'defaultvalue' => $artefact->get('tags')), 'license' => license_form_el_basic($artefact), 'licensing_advanced' => license_form_el_advanced($artefact), 'filebrowser' => array('type' => 'filebrowser', 'title' => get_string('attachments', 'artefact.blog'), 'folder' => $folder, 'highlight' => $highlight, 'browse' => $browse, 'page' => get_config('wwwroot') . 'artefact/internal/editnote.php?id=' . $note . '&browse=1', 'browsehelp' => 'browsemyfiles', 'config' => array('upload' => true, 'uploadagreement' => get_config_plugin('artefact', 'file', 'uploadagreement'), 'resizeonuploaduseroption' => get_config_plugin('artefact', 'file', 'resizeonuploaduseroption'), 'resizeonuploaduserdefault' => $USER->get_account_preference('resizeonuploaduserdefault'), 'createfolder' => false, 'edit' => false, 'select' => true), 'defaultvalue' => $artefact->attachment_id_list(), 'selectlistcallback' => 'artefact_get_records_by_id', 'selectcallback' => 'add_note_attachment', 'unselectcallback' => 'delete_note_attachment'), 'allowcomments' => array('type' => 'switchbox', 'title' => get_string('allowcomments', 'artefact.comment'), 'defaultvalue' => $artefact->get('allowcomments')), 'perms' => array('type' => 'rolepermissions', 'title' => get_string('Permissions'), 'defaultvalue' => $artefact->get('rolepermissions'), 'group' => $group, 'ignore' => !$group), 'submitnote' => array('type' => 'submitcancel', 'class' => 'btn-primary', 'value' => array(get_string('save'), get_string('cancel')), 'goto' => $goto)));
if (!get_config('licensemetadata')) {
    unset($form['elements']['license']);
    unset($form['elements']['licensing_advanced']);
}
$form = pieform($form);
/*
 * Javascript specific to this page.  Creates the list of files
 * attached to the note.
 */
$wwwroot = get_config('wwwroot');
$noimagesmessage = json_encode(get_string('noimageshavebeenattachedtothispost', 'artefact.blog'));
$javascript = <<<EOF
function editnote_callback(form, data) {
    editnote_filebrowser.callback(form, data);
};
Exemplo n.º 11
0
define('SECTION_PAGE', 'index');
define('RESUME_SUBPAGE', 'license');
require_once dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('resume', 'artefact.resume'));
require_once 'pieforms/pieform.php';
require_once 'license.php';
safe_require('artefact', 'resume');
if (!get_config('licensemetadata')) {
    redirect('/artefact/resume');
}
$personalinformation = null;
try {
    $personalinformation = artefact_instance_from_type('personalinformation');
} catch (Exception $e) {
}
$form = array('name' => 'resumelicense', 'plugintype' => 'artefact', 'pluginname' => 'resume', 'elements' => array('license' => license_form_el_basic($personalinformation), 'license_advanced' => license_form_el_advanced($personalinformation), 'submit' => array('type' => 'submit', 'value' => get_string('save'))));
$form = pieform($form);
function resumelicense_submit(Pieform $form, $values)
{
    global $personalinformation, $USER;
    $userid = $USER->get('id');
    if (empty($personalinformation)) {
        $personalinformation = new ArtefactTypePersonalinformation(0, array('owner' => $userid, 'title' => get_string('personalinformation', 'artefact.resume')));
    }
    if (get_config('licensemetadata')) {
        $personalinformation->set('license', $values['license']);
        $personalinformation->set('licensor', $values['licensor']);
        $personalinformation->set('licensorurl', $values['licensorurl']);
    }
    $personalinformation->commit();
    $result = array('error' => false, 'message' => get_string('resumesaved', 'artefact.resume'), 'goto' => get_config('wwwroot') . 'artefact/resume/license.php');
Exemplo n.º 12
0
 /**
  * Gets the new/edit fields for the activities pieform
  *
  */
 public static function get_activityform_elements($parent, $activity = null)
 {
     $elements = array('title' => array('type' => 'text', 'defaultvalue' => null, 'title' => get_string('activity', 'artefact.cpds'), 'description' => get_string('titledesc', 'artefact.cpds'), 'size' => 30, 'rules' => array('required' => true)), 'location' => array('type' => 'text', 'size' => 30, 'defaultvalue' => null, 'title' => get_string('location', 'artefact.cpds'), 'description' => get_string('locationdesc', 'artefact.cpds'), 'rules' => array('required' => true)), 'startdate' => array('type' => 'calendar', 'caloptions' => array('showsTime' => false, 'ifFormat' => '%Y/%m/%d', 'dateFormat' => 'yy/mm/dd'), 'defaultvalue' => null, 'title' => get_string('startdate', 'artefact.cpds'), 'description' => get_string('dateformatguide'), 'rules' => array('required' => true)), 'enddate' => array('type' => 'calendar', 'caloptions' => array('showsTime' => false, 'ifFormat' => '%Y/%m/%d', 'dateFormat' => 'yy/mm/dd'), 'defaultvalue' => null, 'title' => get_string('enddate', 'artefact.cpds'), 'description' => get_string('dateformatguide'), 'rules' => array('required' => false)), 'description' => array('type' => 'wysiwyg', 'rows' => 10, 'cols' => 70, 'resizable' => false, 'defaultvalue' => null, 'title' => get_string('description', 'artefact.cpds'), 'rules' => array('maxlength' => 65536)), 'tags' => array('type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdescprofile')), 'hours' => array('type' => 'text', 'size' => 7, 'defaultvalue' => 0.0, 'title' => get_string('hours', 'artefact.cpds'), 'description' => get_string('hoursdesc', 'artefact.cpds')));
     if (!empty($activity)) {
         foreach ($elements as $k => $element) {
             $elements[$k]['defaultvalue'] = $activity->get($k);
         }
         $elements['activity'] = array('type' => 'hidden', 'value' => $activity->id);
     }
     if (get_config('licensemetadata')) {
         $elements['license'] = license_form_el_basic($activity);
         $elements['license_advanced'] = license_form_el_advanced($activity);
     }
     $elements['parent'] = array('type' => 'hidden', 'value' => $parent);
     return $elements;
 }