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


PHP get_records_select_array函数代码示例

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


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

示例1: setup_links

 public static function setup_links(&$links, $viewids, $artefactids)
 {
     $viewlist = join(',', array_map('intval', $viewids));
     $artefactlist = join(',', array_map('intval', $artefactids));
     $records = get_records_select_array('artefact_comment_comment', "artefact IN ({$artefactlist}) AND onview IN ({$viewlist})", array(), '', 'artefact,onview');
     if ($records) {
         foreach ($records as &$r) {
             if (!isset($links->viewartefact[$r->onview][$r->artefact])) {
                 $links->viewartefact[$r->onview][$r->artefact] = array();
             }
             $links->viewartefact[$r->onview][$r->artefact][] = 'reflected_on_by';
             if (!isset($links->artefactview[$r->artefact][$r->onview])) {
                 $links->artefactview[$r->artefact][$r->onview] = array();
             }
             $links->artefactview[$r->artefact][$r->onview][] = 'reflects_on';
         }
     }
     $records = get_records_select_array('artefact_comment_comment', "artefact IN ({$artefactlist}) AND onartefact IN ({$artefactlist})", array(), '', 'artefact,onartefact');
     if ($records) {
         foreach ($records as &$r) {
             if (!isset($links->artefactartefact[$r->onartefact][$r->artefact])) {
                 $links->artefactartefact[$r->onartefact][$r->artefact] = array();
             }
             $links->artefactartefact[$r->onartefact][$r->artefact][] = 'reflected_on_by';
             if (!isset($links->artefactartefact[$r->artefact][$r->onartefact])) {
                 $links->artefactartefact[$r->artefact][$r->onartefact] = array();
             }
             $links->artefactartefact[$r->artefact][$r->onartefact][] = 'reflects_on';
         }
     }
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:31,代码来源:lib.php

示例2: setup_links

 public static function setup_links(&$links, $viewids, $artefactids)
 {
     $viewlist = join(',', array_map('intval', $viewids));
     $artefactlist = join(',', array_map('intval', $artefactids));
     // Get the annotations that are on these views.
     $records = get_records_select_array('artefact_annotation', "view IN ({$viewlist})", array(), '', 'annotation,view');
     if ($records) {
         foreach ($records as &$r) {
             // view is reflected_on_by annotation (at the current moment).
             if (!isset($links->viewartefact[$r->view][$r->annotation])) {
                 $links->viewartefact[$r->view][$r->annotation] = array();
             }
             $links->viewartefact[$r->view][$r->annotation][] = 'reflected_on_by';
             // annotation reflects_on view (at the current moment).
             if (!isset($links->artefactview[$r->annotation][$r->view])) {
                 $links->artefactview[$r->annotation][$r->view] = array();
             }
             $links->artefactview[$r->annotation][$r->view][] = 'reflects_on';
             // Get the embedded images in the annotation.
             $sql = "SELECT fileid\n                        FROM {artefact_file_embedded}\n                        WHERE resourceid = ?";
             if ($files = get_records_sql_array($sql, array($r->annotation))) {
                 foreach ($files as $file) {
                     $links->attachments[$r->annotation][$file->fileid] = 1;
                 }
             }
             // Get the feedback on the annotation.
             $sql = "SELECT f.artefact as feedback\n                        FROM {artefact_annotation_feedback} f\n                        WHERE f.onannotation = ?\n                        AND f.deletedby IS NULL\n                        ORDER BY f.artefact DESC";
             if ($annotationfeedback = get_records_sql_array($sql, array($r->annotation))) {
                 foreach ($annotationfeedback as $f) {
                     // feedback reflects_on annotation.
                     if (!isset($links->artefactartefact[$f->feedback][$r->annotation])) {
                         $links->artefactartefact[$f->feedback][$r->annotation] = array();
                     }
                     $links->artefactartefact[$f->feedback][$r->annotation][] = 'reflects_on';
                     // annotation is reflected_on_by feedback.
                     if (!isset($links->artefactartefact[$r->annotation][$f->feedback])) {
                         $links->artefactartefact[$r->annotation][$f->feedback] = array();
                     }
                     $links->artefactartefact[$r->annotation][$f->feedback][] = 'reflected_on_by';
                     // Get the embedded images in the annotation feedback.
                     $sql = "SELECT *\n                                FROM {artefact_file_embedded}\n                                WHERE resourceid = ?";
                     if ($files = get_records_sql_array($sql, array($f->feedback))) {
                         foreach ($files as $file) {
                             $links->attachments[$f->feedback][$file->fileid] = 1;
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:51,代码来源:lib.php

示例3: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $userid = $instance->get_view()->get('owner');
     if (!$userid) {
         return '';
     }
     $smarty = smarty_core();
     // Get viewable views
     $views = array();
     if ($allviews = get_records_select_array('view', 'owner = ? AND type = ?', array($userid, 'portfolio'))) {
         foreach ($allviews as $view) {
             if (can_view_view($view->id)) {
                 $views[$view->id] = $view;
                 $view->artefacts = array();
                 $view->description = str_shorten_html($view->description, 100, true);
             }
         }
     }
     if ($views) {
         $viewidlist = implode(', ', array_map(create_function('$a', 'return $a->id;'), $views));
         $artefacts = get_records_sql_array('SELECT va.view, va.artefact, a.title, a.artefacttype, t.plugin
             FROM {view_artefact} va
             INNER JOIN {artefact} a ON va.artefact = a.id
             INNER JOIN {artefact_installed_type} t ON a.artefacttype = t.name
             WHERE va.view IN (' . $viewidlist . ')
             GROUP BY 1, 2, 3, 4, 5
             ORDER BY a.title, va.artefact', '');
         if ($artefacts) {
             foreach ($artefacts as $artefactrec) {
                 safe_require('artefact', $artefactrec->plugin);
                 // Perhaps I shouldn't have to construct the entire
                 // artefact object to render the name properly.
                 $classname = generate_artefact_class_name($artefactrec->artefacttype);
                 $artefactobj = new $classname(0, array('title' => $artefactrec->title));
                 $artefactobj->set('dirty', false);
                 if (!$artefactobj->in_view_list()) {
                     continue;
                 }
                 $artname = $artefactobj->display_title(30);
                 if (strlen($artname)) {
                     $views[$artefactrec->view]->artefacts[] = array('id' => $artefactrec->artefact, 'title' => $artname);
                 }
             }
         }
     }
     $smarty->assign('VIEWS', $views);
     return $smarty->fetch('blocktype:myviews:myviews.tpl');
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:48,代码来源:lib.php

示例4: local_xmlrpc_key_forced_keyswap

/**
* this function hooks cases of keyswap being called with forced mode.    
* Forced mode can only be used from hosts we trust untill now.
* 
* @see api/xmlrpc/dispatcher.php::keyswap()
* 
* Add : 
*		// PATCH add force mode
*        if (!empty($params[3])){ // requiring force mode
*        	$mnetlocallib = get_config('docroot').'/local/mnet/lib.php';
*        	if (file_exists($mnetlocallib)){
*	        	return local_xmlrpc_key_forced_keyswap($wwwroot, $pubkey, $application);
*	        }
*	        return false;
*        }
*        // /PATCH
*
* after $params decoding for enabling forced mode.
*/
function local_xmlrpc_key_forced_keyswap($wwwroot, $pubkey, $application)
{
    $now = time();
    // reinforced security : only known host with still valid key can force us renewal
    if ($exists = get_records_select_array('host', " wwwroot = '{$wwwroot}' AND deleted = 0 AND publickeyexpires >= {$now} ")) {
        try {
            $peer = new Peer();
            if ($peer->findByWwwroot($wwwroot)) {
                $pk = new PublicKey($pubkey, $wwwroot);
                $peer->publickey = $pk;
                $peer->commit();
            }
            // Mahara return his own key
            $openssl = OpenSslRepo::singleton();
            return $openssl->certificate;
        } catch (Exception $e) {
            throw new SystemException($e->getMessage(), $e->getCode());
        }
    } else {
        throw new SystemException("Fails exists known {$wwwroot} as wwwroot", 6100);
    }
}
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:41,代码来源:lib.php

示例5: pieform_element_filebrowser_configure_tabs

function pieform_element_filebrowser_configure_tabs($viewowner, $prefix)
{
    if ($viewowner['type'] == 'institution' && $viewowner['id'] == 'mahara') {
        // No filebrowser tabs for site views
        return null;
    }
    $tabs = array();
    $subtabs = array();
    $upload = null;
    $selectedsubtab = null;
    if ($viewowner['type'] == 'institution') {
        $selectedtab = param_variable($prefix . '_owner', 'institution');
        $upload = $selectedtab == 'institution';
        $tabs['institution'] = get_string('institutionfiles', 'admin');
    } else {
        if ($viewowner['type'] == 'group') {
            $selectedtab = param_variable($prefix . '_owner', 'group');
            $upload = $selectedtab == 'group';
            $tabs['user'] = get_string('myfiles', 'artefact.file');
            $tabs['group'] = get_string('groupfiles', 'artefact.file');
        } else {
            // $viewowner['type'] == 'user'
            global $USER;
            $selectedtab = param_variable($prefix . '_owner', 'user');
            $upload = $selectedtab == 'user';
            $tabs['user'] = get_string('myfiles', 'artefact.file');
            if ($groups = $USER->get('grouproles')) {
                $tabs['group'] = get_string('groupfiles', 'artefact.file');
                require_once get_config('libroot') . 'group.php';
                $groups = group_get_user_groups($USER->get('id'));
                if ($selectedtab == 'group') {
                    if (!($selectedsubtab = (int) param_variable($prefix . '_ownerid', 0))) {
                        $selectedsubtab = $groups[0]->id;
                    }
                    foreach ($groups as &$g) {
                        $subtabs[$g->id] = $g->name;
                    }
                }
            }
            if ($institutions = $USER->get('institutions')) {
                $tabs['institution'] = get_string('institutionfiles', 'admin');
                $institutions = get_records_select_array('institution', 'name IN (' . join(',', array_map('db_quote', array_keys($institutions))) . ')');
                if ($selectedtab == 'institution') {
                    if (!($selectedsubtab = param_variable($prefix . '_ownerid', ''))) {
                        $selectedsubtab = $institutions[0]->name;
                    }
                    $selectedsubtab = hsc($selectedsubtab);
                    foreach ($institutions as &$i) {
                        $subtabs[$i->name] = $i->displayname;
                    }
                }
            }
        }
    }
    $tabs['site'] = get_string('sitefiles', 'admin');
    return array('tabs' => $tabs, 'subtabs' => $subtabs, 'owner' => $selectedtab, 'ownerid' => $viewowner['type'] == 'group' ? $viewowner['id'] : $selectedsubtab, 'upload' => $upload);
}
开发者ID:rboyatt,项目名称:mahara,代码行数:57,代码来源:filebrowser.php

示例6: requiredfields_submit

function requiredfields_submit(Pieform $form, $values)
{
    global $USER, $SESSION;
    if (isset($values['password1'])) {
        $authobj = AuthFactory::create($USER->authinstance);
        // This method should exist, because if it did not then the change
        // password form would not have been shown.
        if ($password = $authobj->change_password($USER, $values['password1'])) {
            $SESSION->add_ok_msg(get_string('passwordsaved'));
        } else {
            throw new SystemException('Attempt by "' . $USER->get('username') . '@' . $USER->get('institution') . 'to change their password failed');
        }
    }
    if (isset($values['username'])) {
        $SESSION->set('resetusername', false);
        if ($values['username'] != $USER->get('username')) {
            $USER->username = $values['username'];
            $USER->commit();
            $otherfield = true;
        }
    }
    if (isset($values['state'])) {
        $current_app_name = explode(".", $_SERVER["HTTP_HOST"]);
        $current_app_short_name = $current_app_name[0];
        $current_app_short_name = str_replace("http://", "", $current_app_short_name);
        $current_app_short_name = str_replace("https://", "", $current_app_short_name);
        Doctrine_Query::create()->update('GcrUsers')->set('state', '?', $values['state'])->set('country', '?', $values['country'])->where('platform_short_name = ?', $current_app_short_name)->andWhere('user_id = ?', $USER->get('id'))->execute();
    }
    if (isset($values['socialprofile_hidden']) && $values['socialprofile_hidden']) {
        // Socialprofile fields. Save them on their own as they are a fieldset.
        set_profile_field($USER->get('id'), 'socialprofile', $values);
        $otherfield = true;
    }
    foreach ($values as $field => $value) {
        if (in_array($field, array('submit', 'sesskey', 'password1', 'password2', 'username', 'socialprofile_service', 'socialprofile_profiletype', 'socialprofile_profileurl', 'socialprofile_hidden', 'state', 'country'))) {
            continue;
        }
        if ($field == 'email') {
            $email = $values['email'];
            // Need to update the admin email on installation
            if ($USER->get('admin')) {
                $oldemail = get_field('usr', 'email', 'id', $USER->get('id'));
                if ($oldemail == 'admin@example.org') {
                    // we are dealing with the dummy email that is set on install
                    update_record('usr', array('email' => $email), array('id' => $USER->get('id')));
                    update_record('artefact_internal_profile_email', array('email' => $email), array('owner' => $USER->get('id')));
                }
            }
            // Check if a validation email has been sent, if not send one
            if (!record_exists('artefact_internal_profile_email', 'owner', $USER->get('id'))) {
                $key = get_random_key();
                $key_url = get_config('wwwroot') . 'artefact/internal/validate.php?email=' . rawurlencode($email) . '&key=' . $key;
                $key_url_decline = $key_url . '&decline=1';
                try {
                    $sitename = get_config('sitename');
                    email_user((object) array('id' => $USER->get('id'), 'username' => $USER->get('username'), 'firstname' => $USER->get('firstname'), 'lastname' => $USER->get('lastname'), 'preferredname' => $USER->get('preferredname'), 'admin' => $USER->get('admin'), 'staff' => $USER->get('staff'), 'email' => $email), null, get_string('emailvalidation_subject', 'artefact.internal'), get_string('emailvalidation_body1', 'artefact.internal', $USER->get('firstname'), $email, $sitename, $key_url, $sitename, $key_url_decline));
                } catch (EmailException $e) {
                    $SESSION->add_error_msg($email);
                }
                insert_record('artefact_internal_profile_email', (object) array('owner' => $USER->get('id'), 'email' => $email, 'verified' => 0, 'principal' => 1, 'key' => $key, 'expiry' => db_format_timestamp(time() + 86400)));
                $SESSION->add_ok_msg(get_string('validationemailsent', 'artefact.internal'));
            }
        } else {
            set_profile_field($USER->get('id'), $field, $value);
            $otherfield = true;
        }
    }
    if (isset($otherfield)) {
        $SESSION->add_ok_msg(get_string('requiredfieldsset', 'auth'));
    }
    // Update the title of user's first blog if first and/or last name have been changed
    $updatedfields = array_keys($values);
    if (in_array('firstname', $updatedfields) || in_array('lastname', $updatedfields)) {
        safe_require('artefact', 'blog');
        $userblogs = get_records_select_array('artefact', 'artefacttype = \'blog\' AND owner = ?', array($USER->get('id')));
        if ($userblogs && count($userblogs) == 1) {
            $defaultblog = new ArtefactTypeBlog($userblogs[0]->id);
            $defaultblog->set('title', get_string('defaultblogtitle', 'artefact.blog', display_name($USER, null, true)));
            $defaultblog->commit();
        }
    }
    redirect();
}
开发者ID:janaece,项目名称:globalclassroom4_clean-old,代码行数:83,代码来源:lib.php

示例7: get_records_select_array

    ArtefactTypeBlogpost::changepoststatus_form($changepoststatus);
}
if ($delete = param_integer('delete', null)) {
    ArtefactTypeBlogpost::delete_form($delete);
}
if (is_null($id)) {
    if ($institutionname) {
        $records = get_records_select_array('artefact', "artefacttype = 'blog' AND \"institution\" = ?", array($institutionname), 'id ASC');
        if (!$records || count($records) > 1) {
            // There are either no blogs for this institution or more than one so we need to send them to journal list page
            // so they can add one or chose a particular blog by id.
            redirect("/artefact/blog/index.php?institution={$institutionname}");
            exit;
        }
    } else {
        if (!($records = get_records_select_array('artefact', "artefacttype = 'blog' AND \"owner\" = ?", array($USER->get('id')), 'id ASC'))) {
            die_info(get_string('nodefaultblogfound', 'artefact.blog', get_config('wwwroot')));
        }
    }
    if ($records) {
        if (count($records) > 1) {
            // no id supplied and more than one journal so go to journal list page
            redirect("/artefact/blog/index.php");
            exit;
        }
        $id = $records[0]->id;
        $blog = new ArtefactTypeBlog($id, $records[0]);
    }
} else {
    $blog = new ArtefactTypeBlog($id);
}
开发者ID:kienv,项目名称:mahara,代码行数:31,代码来源:index.php

示例8: safe_require

safe_require('artefact', 'internal');
// Check if XSLT extension is loaded properly, because we will need it...
// The XSL extension implements the XSL standard, performing XSLT transformations using the libxslt library.
$xslext = extension_loaded('xsl');
if (!$xslext) {
    $smarty = smarty();
    $missingextensions = array();
    !$xslext && ($missingextensions[] = 'xsl');
    $smarty->assign('missingextensions', $missingextensions);
    $smarty->display('artefact:europass:index.tpl');
    exit;
}
// User's Education history
$artefact_id = get_field('artefact', 'id', 'artefacttype', 'educationhistory', 'owner', $USER->get('id'));
if ($artefact_id !== false) {
    $education_data = get_records_select_array('artefact_resume_educationhistory', "artefact=?", array($artefact_id));
} else {
    $education_data = array();
}
// Locations for various buttons and graphics
$employmentlocation = get_config('wwwroot') . 'artefact/resume/employment.php';
$topbanner = get_config('wwwroot') . 'artefact/europass/images/topbanner.png';
$rightlogo = get_config('wwwroot') . 'artefact/europass/images/rightlogo.png';
$smarty = smarty();
// Check if Mahara release is older than 1.3.0
if (get_config('version') < 2010083102) {
    $SESSION->add_info_msg(get_string('newerversionforcompatibility', 'artefact.europass'));
    $smarty->assign('mahararelease', 1);
}
$smarty->assign('topbanner', $topbanner);
$smarty->assign('rightlogo', $rightlogo);
开发者ID:povsod,项目名称:mahara-artefact-europass,代码行数:31,代码来源:education.php

示例9: auth_instance_get_concerned_users

/**
 * caution non scalable of big installations
 * @param $authid
 * @param $fieldstofetch
 * @return array
 */
function auth_instance_get_concerned_users($authid, $fieldstofetch)
{
    $result = get_records_select_array('usr', "authinstance = " . $authid, null, false, $fieldstofetch);
    $result = empty($result) ? array() : $result;
    return $result;
}
开发者ID:ebugnet,项目名称:mahara_ldap_sync,代码行数:12,代码来源:lib.php

示例10: define

define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'manageinstitutions/sitepages');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'institutionstaticpages');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('institutionstaticpages', 'admin'));
require_once 'pieforms/pieform.php';
require_once 'license.php';
define('DEFAULTPAGE', 'home');
require_once 'institution.php';
$sitepages = array();
$corepagenames = site_content_pages();
$localpagenames = function_exists('local_site_content_pages') ? local_site_content_pages() : array();
if ($pagenames = array_merge($corepagenames, $localpagenames)) {
    $sitepages = get_records_select_array('site_content', 'name IN (' . join(',', array_fill(0, count($pagenames), '?')) . ')', $pagenames);
}
$pageoptions = array();
$institutionelement = get_institution_selector(false);
if (!empty($institutionelement['options']) && sizeof($institutionelement['options']) > 1) {
    $institutionelement['defaultvalue'] = key($institutionelement['options']);
} else {
    if (!empty($institutionelement['options']) && sizeof($institutionelement['options']) == 1) {
        // Institutional admins with only 1 institution do not get institution dropdown
        // Same with admins and only one institution exists
        $institutionelement = array('type' => 'hidden', 'value' => key($institutionelement['options']), 'defaultvalue' => key($institutionelement['options']));
    } else {
        if (empty($institutionelement['options'])) {
            // Only the 'no institution' institution exists so we need to display this fact
            $smarty = smarty();
            $smarty->assign('noinstitutionsadmin', $USER->admin ? get_string('noinstitutionstaticpagesadmin', 'admin', get_config('wwwroot') . 'admin/site/pages.php') : false);
开发者ID:rboyatt,项目名称:mahara,代码行数:31,代码来源:institutionpages.php

示例11: group_get_groups_for_editing

/**
 * Fetch group records from the db and convert them to a format suitable
 * for passing into group_update().
 *
 * @param array $ids List of group ids
 *
 * @return array of stdclass objects
 */
function group_get_groups_for_editing($ids = null)
{
    if (empty($ids)) {
        return array();
    }
    $ids = array_map('intval', $ids);
    $groups = get_records_select_array('group', 'id IN (' . join(',', array_fill(0, count($ids), '?')) . ') AND deleted = 0', $ids);
    if (!$groups) {
        return array();
    }
    foreach ($groups as &$g) {
        $g->open = (int) ($g->jointype == 'open');
        $g->controlled = (int) ($g->jointype == 'controlled');
        unset($g->jointype);
    }
    return $groups;
}
开发者ID:vohung96,项目名称:mahara,代码行数:25,代码来源:group.php

示例12: refresh_feeds

 public static function refresh_feeds()
 {
     if (!($feeds = get_records_select_array('blocktype_externalfeed_data', 'lastupdate < ?', array(db_format_timestamp(strtotime('-30 minutes'))), '', 'id,url,' . db_format_tsfield('lastupdate', 'tslastupdate')))) {
         return;
     }
     $yesterday = time() - 60 * 60 * 24;
     foreach ($feeds as $feed) {
         // Hack to stop the updating of dead feeds from delaying other
         // more important stuff that runs on cron.
         if (defined('CRON') && $feed->tslastupdate < $yesterday) {
             // We've been trying for 24 hours already, so waste less
             // time on this one and just try it once a day
             if (mt_rand(0, 24) != 0) {
                 continue;
             }
         }
         try {
             $data = self::parse_feed($feed->url);
             $data->id = $feed->id;
             $data->lastupdate = db_format_timestamp(time());
             $data->content = serialize($data->content);
             $data->image = serialize($data->image);
             update_record('blocktype_externalfeed_data', $data);
         } catch (XML_Feed_Parser_Exception $e) {
             // The feed must have changed in such a way as to become
             // invalid since it was added. We ignore this case in the hope
             // the feed will become valid some time later
         }
     }
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:30,代码来源:lib.php

示例13: export

 /**
  * Main export routine
  */
 public function export()
 {
     global $THEME, $SESSION;
     raise_memory_limit('128M');
     $summaries = array();
     $plugins = plugins_installed('artefact', true);
     $exportplugins = array();
     $progressstart = 15;
     $progressend = 25;
     $plugincount = count($plugins);
     // First pass: find out which plugins are exporting like us, and ask
     // them about the static data they want to include in every template
     $i = 0;
     foreach ($plugins as $plugin) {
         $plugin = $plugin->name;
         $this->notify_progress_callback(intval($progressstart + ++$i / $plugincount * ($progressend - $progressstart)), get_string('preparing', 'export.html', $plugin));
         if (safe_require('export', 'html/' . $plugin, 'lib.php', 'require_once', true)) {
             $exportplugins[] = $plugin;
             $classname = 'HtmlExport' . ucfirst($plugin);
             if (!is_subclass_of($classname, 'HtmlExportArtefactPlugin')) {
                 throw new SystemException("Class {$classname} does not extend HtmlExportArtefactPlugin as it should");
             }
             safe_require('artefact', $plugin);
             // Find out whether the plugin has static data for us
             $themestaticdirs = array_reverse($THEME->get_path('', true, 'artefact/' . $plugin . '/export/html'));
             foreach ($themestaticdirs as $dir) {
                 $staticdir = substr($dir, strlen(get_config('docroot') . 'artefact/'));
                 $this->pluginstaticdirs[] = $staticdir;
                 foreach (array('style.css') as $stylesheet) {
                     if (is_readable($dir . 'style/' . $stylesheet)) {
                         $this->stylesheets[$plugin][] = str_replace('export/html/', '', $staticdir) . 'style/' . $stylesheet;
                     }
                 }
             }
         }
     }
     // Second pass: actually dump data for active export plugins
     $progressstart = 25;
     $progressend = 50;
     $i = 0;
     foreach ($exportplugins as $plugin) {
         $this->notify_progress_callback(intval($progressstart + ++$i / $plugincount * ($progressend - $progressstart)), get_string('exportingdatafor', 'export.html', $plugin));
         $classname = 'HtmlExport' . ucfirst($plugin);
         $artefactexporter = new $classname($this);
         $artefactexporter->dump_export_data();
         // If just exporting a list of views, we don't care about the summaries for each artefact plugin
         if (!(($this->viewexportmode == PluginExport::EXPORT_LIST_OF_VIEWS || $this->viewexportmode == PluginExport::EXPORT_COLLECTIONS) && $this->artefactexportmode == PluginExport::EXPORT_ARTEFACTS_FOR_VIEWS)) {
             $summaries[$plugin] = array($artefactexporter->get_summary_weight(), $artefactexporter->get_summary());
         }
     }
     // Views in collections
     if (!$this->exportingoneview && $this->collections) {
         $viewlist = join(',', array_keys($this->views));
         $collectionlist = join(',', array_keys($this->collections));
         $records = get_records_select_array('collection_view', "view IN ({$viewlist}) AND collection IN ({$collectionlist})");
         if ($records) {
             foreach ($records as &$r) {
                 $this->collectionview[$r->collection][] = $r->view;
                 $this->viewcollection[$r->view] = $r->collection;
             }
         }
     }
     // Get the view data
     $this->notify_progress_callback(55, get_string('exportingviews', 'export'));
     $this->dump_view_export_data();
     if (!$this->exportingoneview) {
         $summaries['view'] = array(100, $this->get_view_summary());
         // Sort by weight (then drop the weight information)
         $this->notify_progress_callback(75, get_string('buildingindexpage', 'export.html'));
         uasort($summaries, create_function('$a, $b', 'return $a[0] > $b[0];'));
         foreach ($summaries as &$summary) {
             $summary = $summary[1];
         }
         // Build index.html
         $this->build_index_page($summaries);
     }
     // Copy all static files into the export
     $this->notify_progress_callback(80, get_string('copyingextrafiles', 'export.html'));
     $this->copy_static_files();
     // Copy all resized images that were found while rewriting the HTML
     $copyproxy = HtmlExportCopyProxy::singleton();
     $copydata = $copyproxy->get_copy_data();
     foreach ($copydata as $from => $to) {
         $to = $this->get('exportdir') . '/' . $this->get('rootdir') . $to;
         if (!check_dir_exists(dirname($to))) {
             $SESSION->add_error_msg(get_string('couldnotcreatedirectory', 'export', $todir));
         }
         if (!copy($from, $to)) {
             $SESSION->add_error_msg(get_string('couldnotcopystaticfile', 'export', $from));
         }
     }
     // zip everything up
     $this->notify_progress_callback(90, get_string('creatingzipfile', 'export'));
     try {
         create_zip_archive($this->exportdir, $this->zipfile, array($this->rootdir));
     } catch (SystemException $e) {
         throw new SystemException('Failed to zip the export file: ' . $e->getMessage());
//.........这里部分代码省略.........
开发者ID:rboyatt,项目名称:mahara,代码行数:101,代码来源:lib.php

示例14: foreach

$prevdeletedid = false;
foreach ($posts as $postid => $post) {
    // Get the number of posts
    $post->postcount = get_postcount($post->poster);
    $post->canedit = $post->parent && ($moderator || user_can_edit_post($post->poster, $post->ctime)) && $ineditwindow;
    $post->ctime = relative_date(get_string('strftimerecentfullrelative', 'interaction.forum'), get_string('strftimerecentfull'), $post->ctime);
    // Get post edit records
    $post->edit = get_postedits($post->id);
    // Get moderator info
    $post->moderator = is_moderator($post->poster) ? $post->poster : null;
    // Update the subject of posts
    $post->subject = !empty($post->subject) ? $post->subject : get_string('re', 'interaction.forum', get_ancestorpostsubject($post->id));
    // If this is the own post
    $post->ownpost = $USER->get('id') == $post->poster ? true : false;
    // Reported reason data
    $post->reports = get_records_select_array('objectionable', 'objecttype = ? AND objectid = ? AND resolvedby IS NULL AND resolvedtime IS NULL', array('forum', $post->id));
    // Consolidate deleted message posts by the same author into one "X posts by Spammer Joe were deleted"
    if ($post->deleted) {
        if ($prevdeletedid && $posts[$prevdeletedid]->poster == $post->poster) {
            $posts[$prevdeletedid]->deletedcount++;
            unset($posts[$postid]);
        } else {
            $prevdeletedid = $postid;
            $post->deletedcount = 1;
        }
    } else {
        $prevdeletedid = false;
    }
}
// If the user has internal notifications for this topic, mark them
// all as read.  Obviously there's no guarantee the user will actually
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:topic.php

示例15: removeMembers

 public function removeMembers($userids)
 {
     // Remove self last.
     global $USER;
     $users = get_records_select_array('usr', 'id IN (' . join(',', array_map('intval', $userids)) . ')');
     $removeself = false;
     foreach ($users as $user) {
         if ($user->id == $USER->id) {
             $removeself = true;
             continue;
         }
         $this->removeMember($user);
     }
     if ($removeself) {
         $USER->leave_institution($this->name);
     }
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:17,代码来源:institution.php


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