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


PHP get_config函数代码示例

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


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

示例1: xrd_init

function xrd_init(&$a)
{
    $uri = urldecode(notags(trim($_GET['uri'])));
    if (substr($uri, 0, 4) === 'http') {
        $name = basename($uri);
    } else {
        $local = str_replace('acct:', '', $uri);
        if (substr($local, 0, 2) == '//') {
            $local = substr($local, 2);
        }
        $name = substr($local, 0, strpos($local, '@'));
    }
    $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1", dbesc($name));
    if (!count($r)) {
        killme();
    }
    $salmon_key = salmon_key($r[0]['spubkey']);
    header('Access-Control-Allow-Origin: *');
    header("Content-type: text/xml");
    if (get_config('system', 'diaspora_enabled')) {
        //$tpl = file_get_contents('view/xrd_diaspora.tpl');
        $tpl = get_markup_template('xrd_diaspora.tpl');
        $dspr = replace_macros($tpl, array('$baseurl' => $a->get_baseurl(), '$dspr_guid' => $r[0]['guid'], '$dspr_key' => base64_encode(pemtorsa($r[0]['pubkey']))));
    } else {
        $dspr = '';
    }
    //$tpl = file_get_contents('view/xrd_person.tpl');
    $tpl = get_markup_template('xrd_person.tpl');
    $o = replace_macros($tpl, array('$nick' => $r[0]['nickname'], '$accturi' => $uri, '$profile_url' => $a->get_baseurl() . '/profile/' . $r[0]['nickname'], '$hcard_url' => $a->get_baseurl() . '/hcard/' . $r[0]['nickname'], '$atom' => $a->get_baseurl() . '/dfrn_poll/' . $r[0]['nickname'], '$zot_post' => $a->get_baseurl() . '/post/' . $r[0]['nickname'], '$poco_url' => $a->get_baseurl() . '/poco/' . $r[0]['nickname'], '$photo' => $a->get_baseurl() . '/photo/profile/' . $r[0]['uid'] . '.jpg', '$dspr' => $dspr, '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'], '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention', '$subscribe' => $a->get_baseurl() . '/follow?url={uri}', '$modexp' => 'data:application/magic-public-key,' . $salmon_key, '$bigkey' => salmon_key($r[0]['pubkey'])));
    $arr = array('user' => $r[0], 'xml' => $o);
    call_hooks('personal_xrd', $arr);
    echo $arr['xml'];
    killme();
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:34,代码来源:xrd.php

示例2: deletepost_submit

function deletepost_submit(Pieform $form, $values)
{
    global $SESSION, $USER;
    $objectionable = get_record_sql("SELECT fp.id\n            FROM {interaction_forum_post} fp\n            JOIN {objectionable} o\n            ON (o.objecttype = 'forum' AND o.objectid = fp.id)\n            WHERE fp.id = ?\n            AND o.resolvedby IS NULL\n            AND o.resolvedtime IS NULL", array($values['post']));
    if ($objectionable !== false) {
        // Trigger activity.
        $data = new StdClass();
        $data->postid = $values['post'];
        $data->message = '';
        $data->reporter = $USER->get('id');
        $data->ctime = time();
        $data->event = DELETE_OBJECTIONABLE_POST;
        activity_occurred('reportpost', $data, 'interaction', 'forum');
    }
    update_record('interaction_forum_post', array('deleted' => 1), array('id' => $values['post']));
    $SESSION->add_ok_msg(get_string('deletepostsuccess', 'interaction.forum'));
    // Figure out which parent record to redirect us to. If the parent record is deleted,
    // keep moving up the chain until you find one that's not deleted.
    $postrec = new stdClass();
    $postrec->parent = $values['parent'];
    do {
        $postrec = get_record('interaction_forum_post', 'id', $postrec->parent, null, null, null, null, 'id, deleted, parent');
    } while ($postrec && $postrec->deleted && $postrec->parent);
    $redirecturl = get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $values['topic'];
    if ($postrec && $postrec->parent) {
        $redirecturl .= '&post=' . $postrec->id;
    }
    redirect($redirecturl);
}
开发者ID:rboyatt,项目名称:mahara,代码行数:29,代码来源:deletepost.php

示例3: definition

 function definition()
 {
     global $CFG, $PAGE;
     $mform = $this->_form;
     $config = get_config('folder');
     //-------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('text', 'name', get_string('name'), array('size' => '48'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEANHTML);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     $this->add_intro_editor($config->requiremodintro);
     $mform->addElement('date_time_selector', 'starttime', get_string('', 'mod_hangout'));
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------
     $this->add_action_buttons();
     //-------------------------------------------------------
     $mform->addElement('hidden', 'revision');
     $mform->setType('revision', PARAM_INT);
     $mform->setDefault('revision', 1);
 }
开发者ID:alokr912,项目名称:moodle-hangout,代码行数:25,代码来源:mod_form.php

示例4: config

function config($key)
{
    static $config_static;
    global $config;
    // UPLOAD_SECRET has a special meaning when empty
    if ($key == 'UPLOAD_SECRET' && (!isset($config['UPLOAD_SECRET']) || $config['UPLOAD_SECRET'] == '')) {
        fatal_error('toegang voor roostermakers is niet geconfigureerd');
    }
    // is this key in the static config?
    // these values can be accessed without database access
    if (isset($config[$key])) {
        return $config[$key];
    }
    // nope, so look in the DB
    if (!isset($config_static)) {
        $config_static = get_config();
    }
    if (!isset($config_static[$key])) {
        fatal_error("Config key {$key} is not set?!?!");
    }
    /*
    	echo('<pre>');
    	print_r($config_static);
    	echo('</pre>');
    	exit;
    */
    return $config_static[$key];
}
开发者ID:ko3st,项目名称:zermelo-web,代码行数:28,代码来源:common.php

示例5: newmember_content

function newmember_content(&$a)
{
    $o = '<h3>' . t('Welcome to Friendica') . '</h3>';
    $o .= '<h3>' . t('New Member Checklist') . '</h3>';
    $o .= '<div style="font-size: 120%;">';
    $o .= t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.');
    $o .= '<ul>';
    $o .= '<li>' . '<a target="newmember" href="settings">' . t('On your <em>Settings</em> page -  change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="settings">' . t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="profile_photo">' . t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</a></li>' . EOL;
    if (in_array('facebook', $a->plugins)) {
        $o .= '<li>' . '<a target="newmember" href="facebook">' . t("Authorise the Facebook Connector if you currently have a Facebook account and we will (optionally) import all your Facebook friends and conversations.") . '</a></li>' . EOL;
    } else {
        $o .= '<li>' . '<a target="newmember" href="help/Installing-Connectors">' . t("<em>If</em> this is your own personal server, installing the Facebook addon may ease your transition to the free social web.") . '</a></li>' . EOL;
    }
    $mail_disabled = function_exists('imap_open') && !get_config('system', 'imap_disabled') ? 0 : 1;
    if (!$mail_disabled) {
        $o .= '<li>' . '<a target="newmember" href="settings/connectors">' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</a></li>' . EOL;
    }
    $o .= '<li>' . '<a target="newmember" href="profiles">' . t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="profiles">' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="directory">' . t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="contacts">' . t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="help">' . t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</a></li>' . EOL;
    $o .= '</div>';
    return $o;
}
开发者ID:nextgensh,项目名称:friendica,代码行数:29,代码来源:newmember.php

示例6: login_ad

function login_ad($user_, $pass_, $tipo_)
{
    //Comienzo la conexión al servidor para tomar los datos de active directory
    $host = get_config('host');
    $puerto = get_config('puerto');
    $filter = "sAMAccountName=" . $user_ . "*";
    $attr = array("displayname", "mail", "givenname", "sn", "useraccountcontrol");
    $dn = get_config('dn');
    $conex = ldap_connect($host, $puerto) or die("No ha sido posible conectarse al servidor");
    if (!ldap_set_option($conex, LDAP_OPT_PROTOCOL_VERSION, 3)) {
        echo "<br>Failed to set protocol version to 3";
    }
    if ($conex) {
        $dominio = get_config("dominio");
        $r = @ldap_bind($conex, $user_ . $dominio, $pass_);
        $existe = get_perfil($user_, $tipo_);
        if ($r && count($existe) > 0) {
            //LOGIN CORRECTO
            $result = ldap_search($conex, $dn, $filter, $attr);
            $entries = ldap_get_entries($conex, $result);
            for ($i = 0; $i < $entries["count"]; $i++) {
                $nombre = fix_data(utf8_decode($entries[$i]["givenname"][0]));
                $apellidos = fix_data(utf8_decode($entries[$i]["sn"][0]));
                $email = fix_data($entries[$i]["mail"][0]);
                //Acutalizar información desde AD en la tabla de empleados
                $s_ = "update empleados set nombre='{$nombre}', apellidos='{$apellidos}', mail='{$email}' where id='{$existe['id']}'";
                $r_ = mysql_query($s_);
                session_name("loginUsuario");
                session_start();
                $_SESSION['NAME'] = $nombre . " " . $apellidos;
                $_SESSION['USER'] = $user_;
                $_SESSION['IDEMP'] = $existe['id'];
                $_SESSION['AUSENCIA'] = get_ausencia($existe['id']);
                $_SESSION['DEPTO'] = $existe['depto'];
                $_SESSION['TYPE'] = $tipo_;
            }
            switch ($tipo_) {
                case "administrador":
                    header("Location: admin/inicio.php");
                    break;
                case "capturista":
                    header("Location: capturista/inicio.php");
                    break;
                case "autorizador":
                    header("Location: autorizador/scrap_firmar.php");
                    break;
                case "reportes":
                    header("Location: reportes/rep_general.php?op=listado");
                    break;
            }
        } else {
            echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=index.php?error=2&user_={$user_}&tipo_={$tipo_}\">";
            exit;
        }
        ldap_close($conex);
    } else {
        echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=index.php?error=3&user_={$user_}&tipo_={$tipo_}\">";
        exit;
    }
}
开发者ID:BrutalAndSick,项目名称:scrap,代码行数:60,代码来源:index11111.php

示例7: notify_user

 public static function notify_user($user, $data)
 {
     $lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
     $separator = str_repeat('-', 72);
     $sitename = get_config('sitename');
     $subject = get_string_from_language($lang, 'emailsubject', 'notification.email', $sitename);
     if (!empty($data->subject)) {
         $subject .= ': ' . $data->subject;
     }
     $messagebody = get_string_from_language($lang, 'emailheader', 'notification.email', $sitename) . "\n";
     $messagebody .= $separator . "\n\n";
     $messagebody .= get_string_from_language($lang, 'subject') . ': ' . $data->subject . "\n\n";
     if ($data->activityname == 'usermessage') {
         // Do not include the message body in user messages when they are sent by email
         // because it encourages people to reply to the email.
         $messagebody .= get_string_from_language($lang, 'newusermessageemailbody', 'group', display_name($data->userfrom), $data->url);
     } else {
         $messagebody .= $data->message;
         if (!empty($data->url)) {
             $messagebody .= "\n\n" . get_string_from_language($lang, 'referurl', 'notification.email', $data->url);
         }
     }
     if (isset($data->unsubscribeurl) && isset($data->unsubscribename)) {
         $messagebody .= "\n\n" . get_string_from_language($lang, 'unsubscribemessage', 'notification.email', $data->unsubscribename, $data->unsubscribeurl);
     }
     $messagebody .= "\n\n{$separator}";
     $prefurl = get_config('wwwroot') . 'account/activity/preferences/';
     $messagebody .= "\n\n" . get_string_from_language($lang, 'emailfooter', 'notification.email', $sitename, $prefurl);
     email_user($user, null, $subject, $messagebody, null, !empty($data->customheaders) ? $data->customheaders : null);
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:30,代码来源:lib.php

示例8: validation

 function validation($data, $files) {
     if (get_config('block_cobalt_reports', 'sqlsecurity')) {
         return $this->validation_high_security($data, $files);
     } else {
         return $this->validation_low_security($data, $files);
     }
 }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:7,代码来源:form.php

示例9: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     safe_require('artefact', 'survey');
     //require_once(dirname(dirname(dirname(__FILE__))) . '/dwoo/function.survey_name.php');
     $configdata = $instance->get('configdata');
     // this will make sure to unserialize it for us
     if (!isset($configdata['artefactid'])) {
         return '';
     }
     $id = $configdata['artefactid'];
     $survey = $instance->get_artefact_instance($id);
     $showresponses = isset($configdata['showresponses']) ? $configdata['showresponses'] : false;
     $showresults = isset($configdata['showresults']) ? $configdata['showresults'] : true;
     $showchart = isset($configdata['showchart']) ? $configdata['showchart'] : true;
     $palette = isset($configdata['palette']) ? $configdata['palette'] : 'default';
     $legend = isset($configdata['legend']) ? $configdata['legend'] : 'key';
     $fonttype = isset($configdata['fonttype']) ? $configdata['fonttype'] : 'sans';
     $fontsize = isset($configdata['fontsize']) ? $configdata['fontsize'] : 10;
     $height = isset($configdata['height']) ? $configdata['height'] : 250;
     $width = isset($configdata['width']) ? $configdata['width'] : 400;
     $smarty = smarty_core();
     //$smarty->addPlugin('survey_name', 'Dwoo_Plugin_survey_name');
     $smarty->assign('RESPONSES', $showresponses ? true : false);
     $smarty->assign('responseshtml', ArtefactTypeSurvey::build_user_responses_output_html($survey->get('title'), unserialize($survey->get('description'))));
     $smarty->assign('RESULTS', $showresults ? true : false);
     $smarty->assign('resultshtml', ArtefactTypeSurvey::build_user_responses_summary_html($survey->get('title'), unserialize($survey->get('description'))));
     $smarty->assign('CHART', $showchart ? true : false);
     $smarty->assign('charturl', get_config('wwwroot') . 'artefact/survey/chart.php?id=' . $id . '&width=' . $width . '&height=' . $height . '&palette=' . $palette . '&legend=' . $legend . '&fonttype=' . $fonttype . '&fontsize=' . $fontsize);
     return $smarty->fetch('blocktype:survey:survey.tpl');
 }
开发者ID:gbleydon,项目名称:mahara-survey,代码行数:30,代码来源:lib.php

示例10: xmldb_repository_dropbox_upgrade

/**
 * @param int $oldversion the version we are upgrading from
 * @return bool result
 */
function xmldb_repository_dropbox_upgrade($oldversion) {
    global $CFG, $DB;

    $dbman = $DB->get_manager();

    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this

    if ($oldversion < 2012080702) {
        // Set the default value for dropbox_cachelimit
        $value = get_config('dropbox', 'dropbox_cachelimit');
        if (empty($value)) {
            set_config('dropbox_cachelimit', 1024*1024, 'dropbox');
        }
        upgrade_plugin_savepoint(true, 2012080702, 'repository', 'dropbox');
    }

    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this


    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.


    return true;
}
开发者ID:verbazend,项目名称:AWFA,代码行数:31,代码来源:upgrade.php

示例11: create_instance

 public function create_instance($record = null, array $options = null)
 {
     global $CFG;
     require_once $CFG->libdir . '/filelib.php';
     $workshopconfig = get_config('workshop');
     // Add default values for workshop.
     $record = (array) $record + array('strategy' => $workshopconfig->strategy, 'grade' => $workshopconfig->grade, 'gradinggrade' => $workshopconfig->gradinggrade, 'gradedecimals' => $workshopconfig->gradedecimals, 'nattachments' => 1, 'maxbytes' => $workshopconfig->maxbytes, 'latesubmissions' => 0, 'useselfassessment' => 0, 'overallfeedbackmode' => 1, 'overallfeedbackfiles' => 0, 'overallfeedbackmaxbytes' => $workshopconfig->maxbytes, 'useexamples' => 0, 'examplesmode' => $workshopconfig->examplesmode, 'submissionstart' => 0, 'submissionend' => 0, 'phaseswitchassessment' => 0, 'assessmentstart' => 0, 'assessmentend' => 0);
     if (!isset($record['gradecategory']) || !isset($record['gradinggradecategory'])) {
         require_once $CFG->libdir . '/gradelib.php';
         $courseid = is_object($record['course']) ? $record['course']->id : $record['course'];
         $gradecategories = grade_get_categories_menu($courseid);
         reset($gradecategories);
         $defaultcategory = key($gradecategories);
         $record += array('gradecategory' => $defaultcategory, 'gradinggradecategory' => $defaultcategory);
     }
     if (!isset($record['instructauthorseditor'])) {
         $record['instructauthorseditor'] = array('text' => 'Instructions for submission ' . ($this->instancecount + 1), 'format' => FORMAT_MOODLE, 'itemid' => file_get_unused_draft_itemid());
     }
     if (!isset($record['instructreviewerseditor'])) {
         $record['instructreviewerseditor'] = array('text' => 'Instructions for assessment ' . ($this->instancecount + 1), 'format' => FORMAT_MOODLE, 'itemid' => file_get_unused_draft_itemid());
     }
     if (!isset($record['conclusioneditor'])) {
         $record['conclusioneditor'] = array('text' => 'Conclusion ' . ($this->instancecount + 1), 'format' => FORMAT_MOODLE, 'itemid' => file_get_unused_draft_itemid());
     }
     return parent::create_instance($record, (array) $options);
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:26,代码来源:lib.php

示例12: pieform_element_captcha

/**
 * Mahara: Electronic portfolio, weblog, resume builder and social networking
 * Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    mahara
 * @subpackage form
 * @author     Catalyst IT Ltd
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
 *
 */
function pieform_element_captcha(Pieform $form, $element)
{
    $id = $form->get_name() . '_' . $element['name'];
    $image = '<img src="' . get_config('wwwroot') . 'captcha.php?name=' . $id . '" alt="' . get_string('captchaimage') . '" style="padding: 2px 0;"><br>';
    $input = '<input type="text" class="text required" id="' . $id . '" name="' . $element['name'] . '" style="width: 137px;" tabindex="' . $form->get_property('tabindex') . '">';
    return $image . ' ' . $input;
}
开发者ID:Br3nda,项目名称:mahara,代码行数:31,代码来源:captcha.php

示例13: menu_setting

 /**
  * 设置菜单
  */
 public function menu_setting()
 {
     $weixin_config = get_config('weixin_config');
     define(AppId, $weixin_config['appid']);
     //定义AppId,需要在微信公众平台申请自定义菜单后会得到
     define(AppSecret, $weixin_config['secret']);
     //定义AppSecret,需要在微信公众平台申请自定义菜单后会得到
     load_function('curl');
     if (isset($GLOBALS['submit'])) {
         $menu_setting = trim($GLOBALS['form']['menu_setting']);
         $menu = load_class('menu', 'weixin');
         //引入微信类
         $creatMenu = $menu->creatMenu($menu_setting);
         //创建菜单
         $creatMenu_arr = json_decode($creatMenu, true);
         if ($creatMenu_arr['errcode'] != 0) {
             MSG($creatMenu);
         } else {
             $this->db->update('setting', array('data' => $menu_setting), array('m' => 'weixin', 'keyid' => 'configs'));
             MSG('创建成功,菜单将在24小时后生效,您可以取消关注,再关注看到最新菜单');
         }
     } else {
         $r = $this->db->get_one('setting', array('m' => 'weixin', 'keyid' => 'configs'));
         $menu_setting = $r['data'];
         include $this->template('menu_setting');
     }
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:30,代码来源:set.php

示例14: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     require_once get_config('docroot') . 'artefact/lib.php';
     $configdata = $instance->get('configdata');
     $viewid = $instance->get('view');
     $wwwroot = get_config('wwwroot');
     $files = array();
     if (isset($configdata['artefactids']) && is_array($configdata['artefactids'])) {
         foreach ($configdata['artefactids'] as $artefactid) {
             try {
                 $artefact = $instance->get_artefact_instance($artefactid);
             } catch (ArtefactNotFoundException $e) {
                 continue;
             }
             $file = array('id' => $artefactid, 'title' => $artefact->get('title'), 'description' => $artefact->get('description'), 'size' => $artefact->get('size'), 'ctime' => $artefact->get('ctime'), 'artefacttype' => $artefact->get('artefacttype'), 'iconsrc' => call_static_method(generate_artefact_class_name($artefact->get('artefacttype')), 'get_icon', array('id' => $artefactid, 'viewid' => $viewid)), 'downloadurl' => $wwwroot);
             if ($artefact instanceof ArtefactTypeProfileIcon) {
                 $file['downloadurl'] .= 'thumb.php?type=profileiconbyid&id=' . $artefactid;
             } else {
                 if ($artefact instanceof ArtefactTypeFile) {
                     $file['downloadurl'] .= 'artefact/file/download.php?file=' . $artefactid . '&view=' . $viewid;
                 }
             }
             $file['is_image'] = $artefact instanceof ArtefactTypeImage ? true : false;
             $files[] = $file;
         }
     }
     $smarty = smarty_core();
     $smarty->assign('viewid', $instance->get('view'));
     $smarty->assign('files', $files);
     return $smarty->fetch('blocktype:filedownload:filedownload.tpl');
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:lib.php

示例15: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $exporter;
     require_once get_config('docroot') . 'artefact/lib.php';
     safe_require('artefact', 'plans');
     $configdata = $instance->get('configdata');
     $smarty = smarty_core();
     if (isset($configdata['artefactid'])) {
         $plan = artefact_instance_from_id($configdata['artefactid']);
         $tasks = ArtefactTypeTask::get_tasks($configdata['artefactid']);
         $template = 'artefact:plans:taskrows.tpl';
         $blockid = $instance->get('id');
         if ($exporter) {
             $pagination = false;
         } else {
             $baseurl = $instance->get_view()->get_url();
             $baseurl .= (false === strpos($baseurl, '?') ? '?' : '&') . 'block=' . $blockid;
             $pagination = array('baseurl' => $baseurl, 'id' => 'block' . $blockid . '_pagination', 'datatable' => 'tasktable_' . $blockid, 'jsonscript' => 'artefact/plans/viewtasks.json.php');
         }
         ArtefactTypeTask::render_tasks($tasks, $template, $configdata, $pagination);
         if ($exporter && $tasks['count'] > $tasks['limit']) {
             $artefacturl = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $configdata['artefactid'] . '&view=' . $instance->get('view');
             $tasks['pagination'] = '<a href="' . $artefacturl . '">' . get_string('alltasks', 'artefact.plans') . '</a>';
         }
         $smarty->assign('owner', $plan->get('owner'));
         $smarty->assign('tags', $plan->get('tags'));
         $smarty->assign('tasks', $tasks);
     } else {
         $smarty->assign('noplans', 'blocktype.plans/plans');
     }
     $smarty->assign('blockid', $instance->get('id'));
     return $smarty->fetch('blocktype:plans:content.tpl');
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:33,代码来源:lib.php


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