• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_records_select_array函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了get_records_select_array函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 == '[email protected]') {
                    // 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


示例16: create_registered_user

 function create_registered_user($profilefields = array())
 {
     global $registration, $SESSION, $USER;
     require_once get_config('libroot') . 'user.php';
     db_begin();
     // Move the user record to the usr table from the registration table
     $registrationid = $registration->id;
     unset($registration->id);
     unset($registration->expiry);
     if ($expirytime = get_config('defaultregistrationexpirylifetime')) {
         $registration->expiry = db_format_timestamp(time() + $expirytime);
     }
     $registration->lastlogin = db_format_timestamp(time());
     $authinstance = get_record('auth_instance', 'institution', $registration->institution, 'authname', $registration->authtype ? $registration->authtype : 'internal');
     if (false == $authinstance) {
         throw new ConfigException('No ' . ($registration->authtype ? $registration->authtype : 'internal') . ' auth instance for institution');
     }
     if (!empty($registration->extra)) {
         // Additional user settings were added during confirmation
         $extrafields = unserialize($registration->extra);
     }
     $user = new User();
     $user->active = 1;
     $user->authinstance = $authinstance->id;
     $user->firstname = $registration->firstname;
     $user->lastname = $registration->lastname;
     $user->email = $registration->email;
     $user->username = get_new_username($user->firstname . $user->lastname);
     $user->passwordchange = 1;
     // Points that indicate the user is a "new user" who should be restricted from spammy activities.
     // We count these down when they do good things; when they have 0 they're no longer a "new user"
     if (is_using_probation()) {
         $user->probation = get_config('probationstartingpoints');
     } else {
         $user->probation = 0;
     }
     if ($registration->institution != 'mahara') {
         if (count_records_select('institution', "name != 'mahara'") == 1 || $registration->pending == 2) {
             if (get_config_plugin('artefact', 'file', 'institutionaloverride')) {
                 $user->quota = get_field('institution', 'defaultquota', 'name', $registration->institution);
             }
         }
     }
     create_user($user, $profilefields);
     // If the institution is 'mahara' then don't do anything
     if ($registration->institution != 'mahara') {
         $institutions = get_records_select_array('institution', "name != 'mahara'");
         // If there is only one available, join it without requiring approval
         if (count($institutions) == 1) {
             $user->join_institution($registration->institution);
         } else {
             if ($registration->pending == 2) {
                 if (get_config('requireregistrationconfirm') || get_field('institution', 'registerconfirm', 'name', $registration->institution)) {
                     $user->join_institution($registration->institution);
                 }
             } else {
                 if ($registration->authtype && $registration->authtype != 'internal') {
                     $auth = AuthFactory::create($authinstance->id);
                     if ($auth->weautocreateusers) {
                         $user->join_institution($registration->institution);
                     } else {
                         $user->add_institution_request($registration->institution);
                     }
                 } else {
                     $user->add_institution_request($registration->institution);
                 }
             }
         }
         if (!empty($extrafields->institutionstaff)) {
             // If the user isn't a member yet, this does nothing, but that's okay, it'll
             // only be set after successful confirmation.
             set_field('usr_institution', 'staff', 1, 'usr', $user->id, 'institution', $registration->institution);
         }
     }
     if (!empty($registration->lang) && $registration->lang != 'default') {
         set_account_preference($user->id, 'lang', $registration->lang);
     }
     // Delete the old registration record
     delete_records('usr_registration', 'id', $registrationid);
     db_commit();
     // Log the user in and send them to the homepage
     $USER = new LiveUser();
     $USER->reanimate($user->id, $authinstance->id);
     if (function_exists('local_post_register')) {
         local_post_register($registration);
     }
     $SESSION->add_ok_msg(get_string('registrationcomplete', 'mahara', get_config('sitename')));
     $SESSION->set('resetusername', true);
     redirect();
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:90,代码来源:register.php


示例17: generate_europasslp_xml

function generate_europasslp_xml($userid, $showHTML = false, $locale = 'en_GB', $internaldateformat = 'dmy11', $externaldateformat = '/numeric/long', $convert = false)
{
    // ================================
    // Load values from Mahara database
    // ================================
    // load user's existing contact information
    $element_list = array('firstname' => 'text', 'lastname' => 'text');
    $contactinfo = array('firstname' => null, 'lastname' => null);
    $contactinfo_data = get_records_select_array('artefact', "owner=? AND artefacttype IN (" . join(",", array_map(create_function('$a', 'return db_quote($a);'), array_keys($element_list))) . ")", array($userid));
    if ($contactinfo_data) {
        foreach ($contactinfo_data as $field) {
            $contactinfo[$field->artefacttype] = $field->title;
        }
    }
    // load user's existing demographics information
    $demographics = null;
    try {
        $demographics = artefact_instance_from_type('personalinformation', $userid);
    } catch (Exception $e) {
    }
    // load user's existing mother tongue(s) and foreign language(s)
    $artefact_id = get_field('artefact', 'id', 'artefacttype', 'mothertongue', 'owner', $userid);
    if ($artefact_id !== false) {
        $mothertongue_list = get_records_select_array('artefact_europass_mothertongue', "artefact=?", array($artefact_id));
    } else {
        $mothertongue_list = array();
    }
    $artefact_id = get_field('artefact', 'id', 'artefacttype', 'otherlanguage', 'owner', $userid);
    if ($artefact_id !== false) {
        $otherlanguage_list = get_records_select_array('artefact_europass_otherlanguage', "artefact=?", array($artefact_id));
    } else {
        $otherlanguage_list = array();
    }
    // ======================
    // Dinamically create XML
    // ======================
    $xmlDoc = new DOMDocument('1.0', 'UTF-8');
    // We want a nice output
    //$xmlDoc->formatOutput = true;
    $styleSheet = $xmlDoc->createProcessingInstruction('xml-stylesheet', 'href="http://europass.cedefop.europa.eu/xml/lp_' . $locale . '_V2.0.xsl" type="text/xsl"');
    $xmlDoc->appendChild($styleSheet);
    $rootElement = $xmlDoc->createElement('europass:learnerinfo');
    $rootNode = $xmlDoc->appendChild($rootElement);
    $rootNode->setAttribute('locale', $locale);
    $rootNode->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
    $rootNode->setAttribute('xmlns:europass', 'http://europass.cedefop.europa.eu/Europass/V2.0');
    $rootNode->setAttribute('xsi:schemaLocation', 'http://europass.cedefop.europa.eu/Europass/V2.0 http://europass.cedefop.europa.eu/xml/EuropassSchema_V2.0.xsd');
    $children = array('docinfo', 'prefs', 'identification', 'languagelist');
    foreach ($children as $child) {
        $childRoot = $xmlDoc->getElementsByTagName('europass:learnerinfo')->item(0);
        $childElement = $xmlDoc->createElement($child);
        $childRoot->appendChild($childElement);
    }
    // =======================
    // Dinamically set docinfo
    // =======================
    // Dinamically set issuedate
    $childRoot = $xmlDoc->getElementsByTagName('docinfo')->item(0);
    $childElement = $xmlDoc->createElement('issuedate');
    $childElement->nodeValue = date('Y-m-d\\TH:i:sP');
    $childRoot->appendChild($childElement);
    // Dinamically set xsdversion
    $childRoot = $xmlDoc->getElement 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_records_select_assoc函数代码示例发布时间:2022-05-15
下一篇:
PHP get_records_select函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap