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


PHP call_static_method函数代码示例

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


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

示例1: dump_export_data

 public function dump_export_data()
 {
     if ($this->exporter->get('viewexportmode') == PluginExport::EXPORT_LIST_OF_VIEWS && $this->exporter->get('artefactexportmode') == PluginExport::EXPORT_ARTEFACTS_FOR_VIEWS) {
         // Dont' care about profile information in this case
         return;
     }
     $smarty = $this->exporter->get_smarty('../../', 'internal');
     $smarty->assign('page_heading', get_string('profilepage', 'artefact.internal'));
     // Profile page
     $profileviewid = $this->exporter->get('user')->get_profile_view()->get('id');
     foreach ($this->exporter->get('views') as $viewid => $view) {
         if ($profileviewid == $viewid) {
             $smarty->assign('breadcrumbs', array(array('text' => 'Profile page', 'path' => 'profilepage.html')));
             $view = $this->exporter->get('user')->get_profile_view();
             $outputfilter = new HtmlExportOutputFilter('../../');
             $smarty->assign('view', $outputfilter->filter($view->build_columns()));
             $content = $smarty->fetch('export:html/internal:profilepage.tpl');
             if (!file_put_contents($this->fileroot . 'profilepage.html', $content)) {
                 throw new SystemException("Unable to write profile page");
             }
             $this->profileviewexported = true;
             break;
         }
     }
     // Generic profile information
     $smarty->assign('page_heading', get_string('profileinformation', 'artefact.internal'));
     $smarty->assign('breadcrumbs', array(array('text' => 'Profile information', 'path' => 'index.html')));
     // Organise profile information by sections, ordered how it's ordered
     // on the 'edit profile' page
     $sections = array('aboutme' => array(), 'contact' => array(), 'messaging' => array(), 'general' => array());
     $elementlist = call_static_method('ArtefactTypeProfile', 'get_all_fields');
     $elementlistlookup = array_flip(array_keys($elementlist));
     $profilefields = get_column_sql('SELECT id FROM {artefact} WHERE owner=? AND artefacttype IN (' . join(",", array_map(create_function('$a', 'return db_quote($a);'), array_keys($elementlist))) . ")", array($this->exporter->get('user')->get('id')));
     foreach ($profilefields as $id) {
         $artefact = artefact_instance_from_id($id);
         $rendered = $artefact->render_self(array('link' => true));
         if ($artefact->get('artefacttype') == 'introduction') {
             $outputfilter = new HtmlExportOutputFilter('../../');
             $rendered['html'] = $outputfilter->filter($rendered['html']);
         }
         $sections[$this->get_category_for_artefacttype($artefact->get('artefacttype'))][$artefact->get('artefacttype')] = array('html' => $rendered['html'], 'weight' => $elementlistlookup[$artefact->get('artefacttype')]);
     }
     // Sort the data and then drop the weighting information
     foreach ($sections as &$section) {
         uasort($section, create_function('$a, $b', 'return $a["weight"] > $b["weight"];'));
         foreach ($section as &$data) {
             $data = $data['html'];
         }
     }
     $smarty->assign('sections', $sections);
     $iconid = $this->exporter->get('user')->get('profileicon');
     if ($iconid) {
         $icon = artefact_instance_from_id($iconid);
         $smarty->assign('icon', '<img src="../../static/profileicons/200px-' . PluginExportHtml::sanitise_path($icon->get('title')) . '" alt="Profile Icon">');
     }
     $content = $smarty->fetch('export:html/internal:index.tpl');
     if (!file_put_contents($this->fileroot . 'index.html', $content)) {
         throw new SystemException("Unable to write profile information page");
     }
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:60,代码来源:lib.php

示例2: 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

示例3: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     require_once get_config('docroot') . 'artefact/lib.php';
     $configdata = $instance->get('configdata');
     $result = '';
     if (isset($configdata['artefactids']) && is_array($configdata['artefactids'])) {
         foreach ($configdata['artefactids'] as $artefactid) {
             try {
                 $artefact = $instance->get_artefact_instance($artefactid);
             } catch (ArtefactNotFoundException $e) {
                 continue;
             }
             $icondata = array('id' => $artefactid, 'viewid' => $instance->get('view'));
             $detailsurl = get_config('wwwroot') . 'view/artefact.php?artefact=' . $artefactid . '&view=' . $instance->get('view');
             if ($artefact instanceof ArtefactTypeProfileIcon) {
                 require_once 'file.php';
                 $downloadurl = get_config('wwwroot') . 'thumb.php?type=profileiconbyid&id=' . $artefactid;
                 $size = filesize(get_dataroot_image_path('artefact/file/profileicons/', $artefactid));
             } else {
                 if ($artefact instanceof ArtefactTypeFile) {
                     $downloadurl = get_config('wwwroot') . 'artefact/file/download.php?file=' . $artefactid . '&view=' . $icondata['viewid'];
                     $size = $artefact->get('size');
                 }
             }
             $result .= '<div title="' . hsc($artefact->get('title')) . '">';
             $result .= '<div class="fl"><a href="' . hsc($downloadurl) . '">';
             $result .= '<img src="' . hsc(call_static_method(generate_artefact_class_name($artefact->get('artefacttype')), 'get_icon', $icondata)) . '" alt=""></a></div>';
             $result .= '<div style="margin-left: 30px;">';
             $result .= '<h4><a href="' . hsc($detailsurl) . '">' . str_shorten_text($artefact->get('title'), 20) . '</a></h4>';
             $description = $artefact->get('description');
             if ($description) {
                 $result .= '<p style="margin: 0;"><strong>' . hsc($description) . '</strong></p>';
             }
             $result .= '' . display_size($size) . ' | ' . strftime(get_string('strftimedaydate'), $artefact->get('ctime'));
             $result .= '</div>';
             $result .= '</div>';
         }
     }
     return $result;
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:40,代码来源:lib.php

示例4: __construct

 /**
  * constructor.  overrides the parent class
  * to set up smarty and the attachment directory
  */
 public function __construct(User $user, $views, $artefacts, $progresshandler = null)
 {
     parent::__construct($user, $views, $artefacts, $progresshandler);
     $this->smarty = smarty_core();
     if (!check_dir_exists($this->exportdir . '/' . $this->filedir)) {
         throw new SystemException("Couldn't create the temporary export directory {$this->exportdir}");
     }
     $this->zipfile = 'mahara-export-leap-user' . $this->get('user')->get('id') . '-' . date('Y-m-d_H-i', $this->exporttime) . '_' . get_random_key() . '.zip';
     // some plugins might want to do their own special thing
     foreach (plugins_installed('artefact', true) as $plugin) {
         $plugin = $plugin->name;
         if (safe_require('export', 'leap/' . $plugin, 'lib.php', 'require_once', true)) {
             $classname = 'LeapExport' . ucfirst($plugin);
             if (class_exists($classname) && call_static_method($classname, 'override_entire_export')) {
                 $this->specialcases[$plugin] = array();
             }
         }
     }
     $outputfilter = LeapExportOutputFilter::singleton();
     $outputfilter->set_artefactids(array_keys($this->artefacts));
     $this->notify_progress_callback(5, get_string('setupcomplete', 'export'));
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:26,代码来源:lib.php

示例5: __construct

 /**
  * Convert a Mahara plugin template file path into a normal template file path with extra search paths.
  *
  * @param string $pluginfile The plugintype, name, and name of file, e.g. "blocktype:clippy:index.tpl"
  * @param int $cacheTime Not used.
  * @param int $cacheId Not used.
  * @param int $compileId Not used.
  * @param array $includePath The paths to look in.
  * @throws MaharaException
  */
 public function __construct($file, $cacheTime = null, $cacheId = null, $compileId = null, $includePath = null)
 {
     global $THEME;
     $parts = explode(':', $file, 3);
     if (count($parts) !== 3) {
         throw new SystemException("Invalid template path \"{$file}\"");
     }
     // Keep the original string for logging purposes
     $dwooref = $file;
     list($plugintype, $pluginname, $file) = $parts;
     // Since we use $plugintype as part of a file path, we should whitelist it
     $plugintype = strtolower($plugintype);
     if (!in_array($plugintype, plugin_types())) {
         throw new SystemException("Invalid plugintype in Dwoo template \"{$dwooref}\"");
     }
     // Get the relative path for this particular plugin
     require_once get_config('docroot') . $plugintype . '/lib.php';
     $pluginpath = call_static_method(generate_class_name($plugintype), 'get_theme_path', $pluginname);
     // Because this is a plugin template file, we don't want to include any accidental matches against
     // core template files with the same name.
     $includePath = array();
     // First look for a local override.
     $includePath[] = get_config('docroot') . "local/theme/{$pluginpath}/templates";
     // Then look for files in a custom theme
     foreach ($THEME->inheritance as $theme) {
         $includePath[] = get_config('docroot') . "theme/{$theme}/{$pluginpath}/templates";
     }
     // Lastly look for files in the plugin itself
     foreach ($THEME->inheritance as $theme) {
         $includePath[] = get_config('docroot') . "{$pluginpath}/theme/{$theme}/templates";
         // For legacy purposes also look for the template file loose under the theme directory.
         $includePath[] = get_config('docroot') . "{$pluginpath}/theme/{$theme}";
     }
     // Now, we instantiate this as a standard Dwoo_Template_File class.
     // We're passing in $file, which is the relative path to the file, and
     // $includePath, which is an array of directories to search for $file in.
     // We let Dwoo figure out which one actually has it.
     parent::__construct($file, null, null, null, $includePath);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:49,代码来源:Dwoo_Template_Mahara.php

示例6: header_search_form

/**
 * Builds the pieform for the search field in the page header
 */
function header_search_form()
{
    $plugin = get_config('searchplugin');
    safe_require('search', $plugin);
    return call_static_method(generate_class_name('search', $plugin), 'header_search_form');
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:9,代码来源:web.php

示例7: artefactchooser_get_element_data

 /**
  * Optional method. If specified, allows the blocktype class to munge the
  * artefactchooser element data before it's templated
  */
 public static function artefactchooser_get_element_data($artefact)
 {
     $folderdata = ArtefactTypeFileBase::artefactchooser_folder_data($artefact);
     $artefact->icon = call_static_method(generate_artefact_class_name($artefact->artefacttype), 'get_icon', array('id' => $artefact->id));
     $artefact->hovertitle = $artefact->description;
     $path = $artefact->parent ? ArtefactTypeFileBase::get_full_path($artefact->parent, $folderdata->data) : '';
     $artefact->description = str_shorten_text($folderdata->ownername . $path . $artefact->title, 30);
     return $artefact;
 }
开发者ID:agwells,项目名称:Mahara-1,代码行数:13,代码来源:lib.php

示例8: get_field_sql

            // If some other cron instance ran the job while we were messing around,
            // skip it.
            $nextrun = get_field_sql('
                SELECT ' . db_format_tsfield('nextrun') . '
                FROM {' . $table . '}
                WHERE plugin = ? AND callfunction = ?', array($job->plugin, $job->callfunction));
            if ($nextrun != $job->nextrun) {
                log_info("Too late to run {$plugintype} {$job->plugin} {$job->callfunction}; skipping.");
                cron_free($job, $start, $plugintype);
                continue;
            }
            $classname = generate_class_name($plugintype, $job->plugin);
            log_info("Running {$classname}::" . $job->callfunction);
            safe_require($plugintype, $job->plugin, 'lib.php', 'require_once');
            try {
                call_static_method($classname, $job->callfunction);
            } catch (Exception $e) {
                log_message($e->getMessage(), LOG_LEVEL_WARN, true, true, $e->getFile(), $e->getLine(), $e->getTrace());
                $output = $e instanceof MaharaException ? $e->render_exception() : $e->getMessage();
                echo "{$output}\n";
                // Don't call handle_exception; try to update next run time and free the lock
            }
            $nextrun = cron_next_run_time($start, (array) $job);
            // update next run time
            set_field($plugintype . '_cron', 'nextrun', db_format_timestamp($nextrun), 'plugin', $job->plugin, 'callfunction', $job->callfunction);
            cron_free($job, $start, $plugintype);
            $now = $fake ? time() - ($realstart - $start) : time();
        }
    }
}
// and now the core ones (much simpler)
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:cron.php

示例9: siteoptions_submit

function siteoptions_submit(Pieform $form, $values)
{
    $fields = array('sitename', 'lang', 'theme', 'dropdownmenu', 'defaultaccountlifetime', 'defaultregistrationexpirylifetime', 'defaultaccountinactiveexpire', 'defaultaccountinactivewarn', 'defaultaccountlifetimeupdate', 'allowpublicviews', 'allowpublicprofiles', 'allowanonymouspages', 'generatesitemap', 'registration_sendweeklyupdates', 'mathjax', 'institutionexpirynotification', 'institutionautosuspend', 'requireregistrationconfirm', 'showselfsearchsideblock', 'nousernames', 'searchplugin', 'showtagssideblock', 'tagssideblockmaxtags', 'country', 'viewmicroheaders', 'userscanchooseviewthemes', 'remoteavatars', 'userscanhiderealnames', 'antispam', 'spamhaus', 'surbl', 'anonymouscomments', 'recaptchaonregisterform', 'recaptchapublickey', 'recaptchaprivatekey', 'loggedinprofileviewaccess', 'disableexternalresources', 'proxyaddress', 'proxyauthmodel', 'proxyauthcredentials', 'smtphosts', 'smtpport', 'smtpuser', 'smtppass', 'smtpsecure', 'noreplyaddress', 'homepageinfo', 'showprogressbar', 'showonlineuserssideblock', 'onlineuserssideblockmaxusers', 'registerterms', 'licensemetadata', 'licenseallowcustom', 'allowmobileuploads', 'creategroups', 'createpublicgroups', 'allowgroupcategories', 'wysiwyg', 'staffreports', 'staffstats', 'userscandisabledevicedetection', 'watchlistnotification_delay', 'masqueradingreasonrequired', 'masqueradingnotified', 'searchuserspublic', 'eventloglevel', 'eventlogexpiry', 'sitefilesaccess', 'exporttoqueue', 'defaultmultipleblogs');
    $count = 0;
    $where_sql = " WHERE admin = 0 AND id != 0";
    // if default account lifetime expiry has no end date
    if (empty($values['defaultaccountlifetime'])) {
        if ($values['defaultaccountlifetimeupdate'] == 'all') {
            // need to remove user expiry
            db_begin();
            $count = count_records_sql("SELECT COUNT(*) FROM {usr} {$where_sql}");
            execute_sql("UPDATE {usr} SET expiry = NULL {$where_sql}");
            db_commit();
        } else {
            // make the 'some' option the same as 'none' as it is meaningless to
            // update existing users without expiry date to having 'no end date'
            $values['defaultaccountlifetimeupdate'] = 'none';
        }
    } else {
        // fetch all the users that are not siteadmins
        $user_expiry = mktime(0, 0, 0, date('n'), date('j'), date('Y')) + (int) $values['defaultaccountlifetime'];
        if ($values['defaultaccountlifetimeupdate'] == 'some') {
            // and the user's expiry is not set
            $where_sql .= " AND expiry IS NULL";
            $count = count_records_sql("SELECT COUNT(*) FROM {usr} {$where_sql}");
            db_begin();
            execute_sql("UPDATE {usr} SET expiry = ? {$where_sql}", array(format_date($user_expiry)));
            db_commit();
        } else {
            if ($values['defaultaccountlifetimeupdate'] == 'all') {
                // and the user's expiry is set
                db_begin();
                $count = count_records_sql("SELECT COUNT(*) FROM {usr} {$where_sql}");
                execute_sql("UPDATE {usr} SET expiry = ? {$where_sql}", array(format_date($user_expiry)));
                db_commit();
            }
        }
    }
    // if public views are disabled, sitemap generation must also be disabled.
    if ($values['allowpublicviews'] == false) {
        $values['generatesitemap'] = false;
    } else {
        // Ensure allowpublicprofiles is set as well
        $values['allowpublicprofiles'] = 1;
    }
    $oldsearchplugin = get_config('searchplugin');
    $oldlanguage = get_config('lang');
    $oldtheme = get_config('theme');
    foreach ($fields as $field) {
        if (!set_config($field, $values[$field])) {
            siteoptions_fail($form, $field);
        }
    }
    if ($oldlanguage != $values['lang']) {
        safe_require('artefact', 'file');
        ArtefactTypeFolder::change_public_folder_name($oldlanguage, $values['lang']);
    }
    save_notification_settings($values, null, true);
    if ($oldsearchplugin != $values['searchplugin']) {
        // Call the old search plugin's sitewide cleanup method
        safe_require('search', $oldsearchplugin);
        call_static_method(generate_class_name('search', $oldsearchplugin), 'cleanup_sitewide');
        // Call the new search plugin's sitewide initialize method
        safe_require('search', $values['searchplugin']);
        $initialize = call_static_method(generate_class_name('search', $values['searchplugin']), 'initialize_sitewide');
        if (!$initialize) {
            $form->reply(PIEFORM_ERR, array('message' => get_string('searchconfigerror1', 'admin', $values['searchplugin']), 'goto' => '/admin/site/options.php'));
        }
    }
    // Call the new search plugin's can connect
    safe_require('search', $values['searchplugin']);
    $connect = call_static_method(generate_class_name('search', $values['searchplugin']), 'can_connect');
    if (!$connect) {
        $form->reply(PIEFORM_ERR, array('message' => get_string('searchconfigerror1', 'admin', $values['searchplugin']), 'goto' => '/admin/site/options.php'));
    }
    // submitted sessionlifetime is in minutes; db entry session_timeout is in seconds
    if (!set_config('session_timeout', $values['sessionlifetime'] * 60)) {
        siteoptions_fail($form, 'sessionlifetime');
    }
    // Submitted value is on/off; database entry should be 1/0
    foreach (array('viruschecking', 'usersallowedmultipleinstitutions') as $checkbox) {
        if (!set_config($checkbox, (int) ($values[$checkbox] == 'on'))) {
            siteoptions_fail($form, $checkbox);
        }
    }
    if ($values['viruschecking'] == 'on') {
        $pathtoclam = escapeshellcmd(trim(get_config('pathtoclam')));
        if (!$pathtoclam) {
            $form->reply(PIEFORM_ERR, array('message' => get_string('clamnotset', 'mahara', $pathtoclam), 'goto' => '/admin/site/options.php'));
        } else {
            if (!file_exists($pathtoclam) && !is_executable($pathtoclam)) {
                $form->reply(PIEFORM_ERR, array('message' => get_string('clamlost', 'mahara', $pathtoclam), 'goto' => '/admin/site/options.php'));
            }
        }
    }
    if (get_config('recaptchaonregisterform') && !(get_config('recaptchapublickey') && get_config('recaptchaprivatekey'))) {
        $form->reply(PIEFORM_ERR, array('message' => get_string('recaptchakeysmissing1', 'admin'), 'goto' => '/admin/site/options.php'));
    }
    // Need to clear the cached menus in case site config changes effect them.
    clear_menu_cache();
//.........这里部分代码省略.........
开发者ID:agwells,项目名称:Mahara-1,代码行数:101,代码来源:options.php

示例10: artefactchooser_get_element_data

 public static function artefactchooser_get_element_data($artefact)
 {
     $artefact->icon = call_static_method(generate_artefact_class_name($artefact->artefacttype), 'get_icon', array('id' => $artefact->id));
     return $artefact;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:5,代码来源:lib.php

示例11: right_nav

function right_nav()
{
    global $USER, $THEME;
    safe_require('notification', 'internal');
    $unread = call_static_method(generate_class_name('notification', 'internal'), 'unread_count', $USER->get('id'));
    $menu = array(array('path' => 'settings', 'wwwroot' => get_config('httpswwwroot'), 'url' => 'account/', 'title' => get_string('settings'), 'icon' => $THEME->get_url('images/settings.png'), 'alt' => get_string('settings'), 'weight' => 10), array('path' => 'inbox', 'url' => 'account/activity', 'icon' => $THEME->get_url('images/email.gif'), 'alt' => get_string('inbox'), 'count' => $unread, 'countclass' => 'unreadmessagecount', 'weight' => 20), array('path' => 'settings/account', 'url' => 'account/', 'title' => get_string('account'), 'weight' => 10), array('path' => 'settings/notifications', 'url' => 'account/activity/preferences/', 'title' => get_string('notifications'), 'weight' => 30), array('path' => 'settings/institutions', 'url' => 'account/institutions.php', 'title' => get_string('institutionmembership'), 'weight' => 40));
    $menu_structure = find_menu_children($menu, '');
    return $menu_structure;
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:9,代码来源:web.php

示例12: get_data

 public function get_data($key, $id)
 {
     if (!isset($this->temp[$key][$id])) {
         $blocktypeclass = generate_class_name('blocktype', $this->get('blocktype'));
         if (!isset($this->temp[$key])) {
             $this->temp[$key] = array();
         }
         $this->temp[$key][$id] = call_static_method($blocktypeclass, 'get_instance_' . $key, $id);
     }
     return $this->temp[$key][$id];
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:11,代码来源:lib.php

示例13: plugin_account_prefs_submit

/**
 * Submit plugin account form values.
 *
 * @param Pieform $form
 * @param array $values
 * @return bool is page need to be refreshed
 */
function plugin_account_prefs_submit(Pieform $form, $values)
{
    $reload = false;
    $elements = array();
    $installed = plugin_all_installed();
    foreach ($installed as $i) {
        if (!safe_require_plugin($i->plugintype, $i->name)) {
            continue;
        }
        $reload = call_static_method(generate_class_name($i->plugintype, $i->name), 'accountprefs_submit', $form, $values) || $reload;
    }
    return $reload;
}
开发者ID:patkira,项目名称:mahara,代码行数:20,代码来源:user.php

示例14: get_goals_and_skills

 public function get_goals_and_skills($type = '')
 {
     global $USER;
     switch ($type) {
         case 'goals':
             $artefacts = array('personalgoal', 'academicgoal', 'careergoal');
             break;
         case 'skills':
             $artefacts = array('personalskill', 'academicskill', 'workskill');
             break;
         default:
             $artefacts = array('personalgoal', 'academicgoal', 'careergoal', 'personalskill', 'academicskill', 'workskill');
     }
     $data = array();
     foreach ($artefacts as $artefact) {
         $record = get_record('artefact', 'artefacttype', $artefact, 'owner', $USER->get('id'));
         if ($record) {
             $record->exists = 1;
             // Add attachments
             $files = ArtefactType::attachments_from_id_list(array($record->id));
             if ($files) {
                 safe_require('artefact', 'file');
                 foreach ($files as &$file) {
                     $file->icon = call_static_method(generate_artefact_class_name($file->artefacttype), 'get_icon', array('id' => $file->attachment));
                     $record->files[] = $file;
                 }
                 $record->count = count($files);
             } else {
                 $record->count = 0;
             }
         } else {
             $record = new stdClass();
             $record->artefacttype = $artefact;
             $record->exists = 0;
             $record->count = 0;
         }
         $data[] = $record;
     }
     return $data;
 }
开发者ID:vohung96,项目名称:mahara,代码行数:40,代码来源:lib.php

示例15: param_integer

$userid = param_integer('user');
define('GROUP', $groupid);
$group = group_current_group();
$user = get_record('usr', 'id', $userid, 'deleted', 0);
if (!$user) {
    throw new UserNotFoundException(get_string('usernotfound', 'group', $userid));
}
if ($group->jointype != 'invite' || group_user_access($groupid) != 'admin') {
    throw new AccessDeniedException(get_string('cannotinvitetogroup', 'group'));
}
if (record_exists('group_member', 'group', $groupid, 'member', $userid) || record_exists('group_member_invite', 'group', $groupid, 'member', $userid)) {
    throw new UserException(get_string('useralreadyinvitedtogroup', 'group'));
}
define('TITLE', get_string('invitemembertogroup', 'group', display_name($userid), $group->name));
$roles = group_get_role_info($groupid);
foreach ($roles as $k => &$v) {
    $v = $v->display;
}
safe_require('grouptype', $group->grouptype);
$form = pieform(array('name' => 'invitetogroup', 'autofocus' => false, 'method' => 'post', 'elements' => array('reason' => array('type' => 'textarea', 'cols' => 50, 'rows' => 4, 'title' => get_string('reason')), 'role' => array('type' => 'select', 'options' => $roles, 'title' => get_string('Role', 'group'), 'defaultvalue' => call_static_method('GroupType' . $group->grouptype, 'default_role')), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('invite', 'group'), get_string('cancel')), 'goto' => get_config('wwwroot') . 'user/view.php?id=' . $userid))));
$smarty = smarty();
$smarty->assign('subheading', TITLE);
$smarty->assign('form', $form);
$smarty->display('group/invite.tpl');
function invitetogroup_submit(Pieform $form, $values)
{
    global $SESSION, $USER, $group, $user;
    group_invite_user($group, $user->id, $USER, $values['role']);
    $SESSION->add_ok_msg(get_string('userinvited', 'group'));
    redirect('/user/view.php?id=' . $user->id);
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:31,代码来源:invite.php


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