Exemplo n.º 1
0
/**
 * Smarty {theme_path} function plugin
 *
 * Type:     function<br>
 * Name:     str<br>
 * Date:     June 22, 2006<br>
 * Purpose:  Fetch the image according to the theme hierarchy
 * @author   Catalyst IT Ltd
 * @version  1.0
 * @param array
 * @param Smarty
 * @return Internationalized string
 */
function smarty_function_theme_path($params, &$smarty)
{
    if (!isset($params['pluginlocation'])) {
        $params['pluginlocation'] = '';
    }
    return theme_get_url($params['location'], $params['pluginlocation']);
}
Exemplo n.º 2
0
function export_form_cell_html($element)
{
    $strclicktopreview = get_string('clicktopreview', 'export');
    $previewimg = theme_get_url('images/icon-display.png');
    $strpreview = get_string('Preview');
    $element['description'] = clean_html($element['description']);
    return <<<EOF
<td>
{$element['html']} {$element['labelhtml']}
<div>{$element['description']}</div>
<div><a href="{$element['viewlink']}" class="viewlink nojs-hidden-inline" target="_blank">{$strclicktopreview}</a></div>
</td>
EOF;
}
Exemplo n.º 3
0
 /**
  * Builds HTML that represents all of the messages and returns it.
  *
  * This is designed to let smarty templates hook in any session messages.
  *
  * Calling this function will destroy the session messages that were
  * rendered, so they do not inadvertently get displayed again.
  *
  * @return string The HTML representing all of the session messages.
  */
 public function render_messages()
 {
     $result = '<div id="messages">';
     if (isset($_SESSION['messages'])) {
         foreach ($_SESSION['messages'] as $data) {
             $result .= '<div class="' . $data['type'] . '">';
             $result .= '<div class="fr"><a href="" onclick="removeElement(this.parentNode.parentNode);return false;">';
             $result .= '<img src="' . theme_get_url('images/icon_close.gif') . '" alt="[X]"></a></div>';
             $result .= $data['msg'] . '</div>';
         }
         $_SESSION['messages'] = array();
     }
     $result .= '</div>';
     return $result;
 }
Exemplo n.º 4
0
 public static function get_icon($options = null)
 {
     return theme_get_url('images/folder.gif');
 }
Exemplo n.º 5
0
        $count = count_records_select('notification_internal_activity', 'usr = ? AND type IN (
         SELECT id FROM {activity_type} WHERE admin = ?)', array($userid, 1));
        $sql = 'SELECT a.*, at.name AS type,at.plugintype, at.pluginname FROM {notification_internal_activity} a 
        JOIN {activity_type} at ON a.type = at.id
        WHERE a.usr = ? AND at.admin = ? ORDER BY ctime DESC';
        $records = get_records_sql_array($sql, array($userid, 1), $offset, $limit);
    } else {
        $count = count_records_select('notification_internal_activity', 'usr = ? AND type = ?', array($userid, $type));
        $sql = 'SELECT a.*, at.name AS type,at.plugintype, at.pluginname FROM {notification_internal_activity} a
        JOIN {activity_type} at ON a.type = at.id
        WHERE a.usr = ? AND a.type = ?';
        $records = get_records_sql_array($sql, array($userid, $type), $offset, $limit);
    }
}
if (empty($records)) {
    $records = array();
}
$data = array();
$star = theme_get_url('images/star.png');
$unread = get_string('unread', 'activity');
foreach ($records as &$r) {
    $r->date = format_date(strtotime($r->ctime));
    $section = 'activity';
    if (!empty($r->plugintype)) {
        $section = $r->plugintype . '.' . $r->pluginname;
    }
    $r->type = get_string('type' . $r->type, $section);
    $r->message = format_whitespace($r->message);
}
$activity = array('count' => $count, 'offset' => $offset, 'limit' => $limit, 'data' => $records, 'star' => $star, 'unread' => $unread);
echo json_encode($activity);
Exemplo n.º 6
0
define('TITLE', get_string('notifications'));
$types = get_records_assoc('activity_type', 'admin', 0, 'plugintype,pluginname,name', 'id,name,plugintype,pluginname');
$types = array_map(create_function('$a', '
    if (!empty($a->plugintype)) { 
        $section = "{$a->plugintype}.{$a->pluginname}";
    }
    else {
        $section = "activity";
    }
    return get_string("type" . $a->name, $section);
    '), $types);
if ($USER->get('admin')) {
    $types['adminmessages'] = get_string('typeadminmessages', 'activity');
}
$morestr = get_string('more...');
$star = json_encode(theme_get_url('images/star.png'));
$unread = json_encode(get_string('unread', 'activity'));
$javascript = <<<JAVASCRIPT
var activitylist = new TableRenderer(
    'activitylist',
    'index.json.php', 
    [
        function(r) { 
            if (r.message) {
                var messagemore = DIV({'id' : 'message-' + r.id, 'style': 'display:none'});
                messagemore.innerHTML = r.message;
                if (r.url) {
                    appendChildNodes(messagemore, BR(null), A({'href' : r.url, 'class': 's'}, '{$morestr}'));
                }
                return TD(null, A({'href': '', 'onclick': 'showHideMessage(' + r.id + '); return false;'}, r.subject),
                          messagemore);
Exemplo n.º 7
0
// Remove all files in the smarty cache
require_once 'file.php';
$basedir = get_config('dataroot') . 'smarty/compile/';
$dh = new DirectoryIterator($basedir);
foreach ($dh as $themedir) {
    if ($themedir->isDot()) {
        continue;
    }
    $themedirname = $basedir . $themedir->getFilename();
    rmdirr($themedirname);
    clearstatcache();
    check_dir_exists($themedirname);
}
$loadingicon = theme_get_url('images/loading.gif');
$successicon = theme_get_url('images/success.gif');
$failureicon = theme_get_url('images/failure.gif');
$loadingstring = json_encode(get_string('upgradeloading', 'admin'));
$installsuccessstring = json_encode(get_string('installsuccess', 'admin'));
$successstring = json_encode(get_string('upgradesuccesstoversion', 'admin'));
$failurestring = json_encode(get_string('upgradefailure', 'admin'));
$coresuccess = json_encode(get_string('coredatasuccess', 'admin'));
// Check if Mahara is being installed. An extra hook is required to insert core
// data if so.
if (!empty($upgrades['core']->install)) {
    $upgrades['firstcoredata'] = true;
    $upgrades['lastcoredata'] = true;
    if (!db_is_utf8()) {
        global $SESSION;
        $SESSION->add_info_msg(get_string('databasenotutf8', 'admin'));
    }
    $smarty->assign('install', true);
Exemplo n.º 8
0
/**
 * 
 */
function get_help_icon($plugintype, $pluginname, $form, $element, $page = '', $section = '')
{
    // I see no reason why IE has to drag the quality of the interwebs down with it
    $imageext = isset($_SERVER['HTTP_USER_AGENT']) && false !== stripos($_SERVER['HTTP_USER_AGENT'], 'msie 6.0') ? 'gif' : 'png';
    return ' <span class="help"><a href="" onclick="' . hsc('contextualHelp(' . json_encode($form) . ',' . json_encode($element) . ',' . json_encode($plugintype) . ',' . json_encode($pluginname) . ',' . json_encode($page) . ',' . json_encode($section) . ',this); return false;') . '"><img src="' . theme_get_url('images/icon_help.' . $imageext) . '" alt="?"></a></span>';
}
Exemplo n.º 9
0
function pieform_element_calendar_configure($element)
{
    $element['jsroot'] = get_config('wwwroot') . 'js/jscalendar/';
    $element['themefile'] = theme_get_url('style/calendar.css');
    $element['imagefile'] = theme_get_url('images/calendar.gif');
    $language = substr(current_language(), 0, 2);
    $element['language'] = $language;
    return $element;
}
Exemplo n.º 10
0
    });
});
EOF;
$smarty = smarty();
$smarty->assign('heading', $forum->groupname);
$smarty->assign('subheading', $forum->title);
$smarty->assign('forum', $forum);
$smarty->assign('membership', $membership);
$smarty->assign('moderator', $moderator);
$smarty->assign('admin', $admin);
$smarty->assign('groupadmins', group_get_admin_ids($forum->groupid));
$smarty->assign('stickytopics', $stickytopics);
$smarty->assign('regulartopics', $regulartopics);
$smarty->assign('moderators', $moderators);
$smarty->assign('closedicon', theme_get_url('images/closed.gif', 'interaction/forum/'));
$smarty->assign('subscribedicon', theme_get_url('images/subscribed.gif', 'interaction/forum/'));
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('INLINEJAVASCRIPT', $inlinejavascript);
$smarty->display('interaction:forum:view.tpl');
/**
 * format body
 * format lastposttime
 */
function setup_topics(&$topics)
{
    if ($topics) {
        foreach ($topics as $topic) {
            $topic->body = str_shorten_html($topic->body, 50, true, false);
            $topic->lastposttime = relative_date(get_string('strftimerecentrelative', 'interaction.forum'), get_string('strftimerecent'), $topic->lastposttime);
        }
    }
Exemplo n.º 11
0
 */
define('INTERNAL', 1);
require dirname(dirname(__FILE__)) . '/init.php';
// Download the export file if it's been generated
if ($exportfile = $SESSION->get('exportfile')) {
    $SESSION->set('exportdata', '');
    $SESSION->set('exportfile', '');
    require_once 'file.php';
    serve_file($exportfile, basename($exportfile), 'application/x-zip', array('lifetime' => 0, 'forcedownload' => true));
    exit;
}
if (!($exportdata = $SESSION->get('exportdata'))) {
    redirect('/export/');
}
$SESSION->set('exportdata', '');
$stylesheets = array_reverse(theme_get_url('style/style.css', null, true));
?>
<html>
    <head>
        <title></title>
<?php 
foreach ($stylesheets as $stylesheet) {
    ?>
        <link rel="stylesheet" type="text/css" href="<?php 
    echo hsc($stylesheet);
    ?>
">
<?php 
}
?>
        <style type="text/css">
Exemplo n.º 12
0
    $interest = artefact_instance_from_type('interest');
} catch (Exception $e) {
}
$contactinformation_value = $contactinformation->render_self(array('editing' => true));
$contactinformation_value = $contactinformation_value['html'];
$coverletterform = pieform(array('name' => 'coverletter', 'jsform' => true, 'plugintype' => 'artefact', 'pluginname' => 'resume', 'jsform' => true, 'method' => 'post', 'elements' => array('coverletterfs' => array('type' => 'fieldset', 'legend' => get_string('coverletter', 'artefact.resume'), 'elements' => array('coverletter' => array('type' => 'wysiwyg', 'cols' => 70, 'rows' => 10, 'defaultvalue' => !empty($coverletter) ? $coverletter->get('description') : null, 'help' => true), 'save' => array('type' => 'submit', 'value' => get_string('save')))))));
$interestsform = pieform(array('name' => 'interests', 'jsform' => true, 'plugintype' => 'artefact', 'pluginname' => 'resume', 'jsform' => true, 'method' => 'post', 'elements' => array('interestsfs' => array('type' => 'fieldset', 'legend' => get_string('interest', 'artefact.resume'), 'elements' => array('interest' => array('type' => 'wysiwyg', 'defaultvalue' => !empty($interest) ? $interest->get('description') : null, 'cols' => 70, 'rows' => 10, 'help' => true), 'save' => array('type' => 'submit', 'value' => get_string('save')))))));
$contactinformationform = pieform(array('name' => 'contactinformation', 'jsform' => true, 'plugintype' => 'artefact', 'pluginname' => 'resume', 'jsform' => true, 'method' => 'post', 'elements' => array('contactinformationfs' => array('type' => 'fieldset', 'legend' => get_string('contactinformation', 'artefact.resume'), 'elements' => array('contactinformation' => array('type' => 'html', 'value' => $contactinformation_value, 'help' => true))))));
$personalinformationform = pieform(array('name' => 'personalinformation', 'jsform' => true, 'plugintype' => 'artefact', 'pluginname' => 'resume', 'jsform' => true, 'method' => 'post', 'elements' => array('personalinformation' => array('type' => 'fieldset', 'legend' => get_string('personalinformation', 'artefact.resume'), 'elements' => array('dateofbirth' => array('type' => 'calendar', 'caloptions' => array('showsTime' => false, 'ifFormat' => '%Y/%m/%d'), 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('dateofbirth') : null, 'title' => get_string('dateofbirth', 'artefact.resume'), 'help' => true), 'placeofbirth' => array('type' => 'text', 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('placeofbirth') : null, 'title' => get_string('placeofbirth', 'artefact.resume')), 'citizenship' => array('type' => 'text', 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('citizenship') : null, 'title' => get_string('citizenship', 'artefact.resume')), 'visastatus' => array('type' => 'text', 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('visastatus') : null, 'title' => get_string('visastatus', 'artefact.resume'), 'help' => true), 'gender' => array('type' => 'radio', 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('gender') : null, 'options' => array('female' => get_string('female', 'artefact.resume'), 'male' => get_string('male', 'artefact.resume')), 'title' => get_string('gender', 'artefact.resume')), 'maritalstatus' => array('type' => 'text', 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('maritalstatus') : null, 'title' => get_string('maritalstatus', 'artefact.resume')), 'save' => array('type' => 'submit', 'value' => get_string('save')))))));
$cancelstr = get_string('cancel');
$addstr = get_string('add');
$editstr = get_string('edit');
$delstr = get_string('delete');
$confirmdelstr = get_string('compositedeleteconfirm', 'artefact.resume');
$imagemoveblockup = json_encode(theme_get_url('images/move-block-up.png'));
$imagemoveblockdown = json_encode(theme_get_url('images/move-block-down.png'));
$upstr = get_string('moveup', 'artefact.resume');
$downstr = get_string('movedown', 'artefact.resume');
$wwwroot = get_config('wwwroot');
$smarty = smarty(array('tablerenderer'));
$smarty->assign('coverletterform', $coverletterform);
$smarty->assign('interestsform', $interestsform);
$smarty->assign('contactinformationform', $contactinformationform);
$smarty->assign('personalinformationform', $personalinformationform);
$inlinejs = <<<EOF
var tableRenderers = {};

function toggleCompositeForm(type) {
    var elemName = ''; 
    elemName = type + 'form';
    if (hasElementClass(elemName, 'hidden')) {