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

PHP get_column函数代码示例

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

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



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

示例1: preprocess_file

 /** 
  * Gets file information out of $_FILES and stores it locally in $files.
  * Checks file against max upload file size.
  * Scans file for viruses.
  * @return false for no errors, or a string describing the error
  */
 function preprocess_file()
 {
     $name = $this->inputname;
     if (!isset($_FILES[$name])) {
         return get_string('noinputnamesupplied');
     }
     $file = $_FILES[$name];
     $maxsize = get_config('maxuploadsize');
     if ($maxsize && $file['size'] > $maxsize) {
         return get_string('uploadedfiletoobig');
     }
     if ($file['error'] != UPLOAD_ERR_OK) {
         $errormsg = get_string('phpuploaderror', 'mahara', get_string('phpuploaderror_' . $file['error']), $file['error']);
         log_debug($errormsg);
         if ($file['error'] == UPLOAD_ERR_NO_TMP_DIR || $file['error'] == UPLOAD_ERR_CANT_WRITE) {
             // The admin probably needs to fix this; notify them
             // @TODO: Create a new activity type for general admin messages.
             $message = (object) array('users' => get_column('usr', 'id', 'admin', 1), 'subject' => get_string('adminphpuploaderror'), 'message' => $errormsg);
             require_once 'activity.php';
             activity_occurred('maharamessage', $message);
         } else {
             if ($file['error'] == UPLOAD_ERR_INI_SIZE || $file['error'] == UPLOAD_ERR_FORM_SIZE) {
                 return get_string('uploadedfiletoobig');
             }
         }
     }
     if (!is_uploaded_file($file['tmp_name'])) {
         return get_string('notphpuploadedfile');
     }
     if (get_config('viruschecking') && ($errormsg = mahara_clam_scan_file($file))) {
         return $errormsg;
     }
     $this->file = $file;
     return false;
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:41,代码来源:uploadmanager.php


示例2: get_allowed_mimetypes

 private static function get_allowed_mimetypes()
 {
     static $mimetypes = array();
     if (!$mimetypes) {
         $mimetypes = get_column('artefact_file_mime_types', 'mimetype', 'description', 'pdf');
     }
     return $mimetypes;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:8,代码来源:lib.php


示例3: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $USER, $THEME;
     $configdata = $instance->get('configdata');
     $desiredtypes = array();
     foreach ($configdata as $k => $v) {
         if (!empty($v) && $k != 'maxitems') {
             $type = preg_replace('/[^a-z]+/', '', $k);
             $desiredtypes[$type] = $type;
         }
     }
     if ($USER->get('admin') && !empty($desiredtypes['adminmessages'])) {
         unset($desiredtypes['adminmessages']);
         $desiredtypes += get_column('activity_type', 'name', 'admin', 1);
     }
     $maxitems = isset($configdata['maxitems']) ? $configdata['maxitems'] : 5;
     // check if multirecipientnotification plugin is active or if we proceed here
     if (record_exists('module_installed', 'name', 'multirecipientnotification', 'active', '1') && safe_require_plugin('module', 'multirecipientnotification')) {
         global $USER;
         $userid = $USER->get('id');
         $activitylist = activityblocklistin(join(',', $desiredtypes), $maxitems);
         $records = $activitylist->records;
         $showmore = $activitylist->count > $maxitems;
         // use a different template
         $smartytemplate = 'blocktype:inbox:inboxmr.tpl';
     } else {
         $records = array();
         if ($desiredtypes) {
             $sql = "\n                    SELECT n.id, n.subject, n.message, n.url, n.urltext, n.read, t.name AS type\n                    FROM {notification_internal_activity} n JOIN {activity_type} t ON n.type = t.id\n                    WHERE n.usr = ?\n                    AND t.name IN (" . join(',', array_map('db_quote', $desiredtypes)) . ")\n                    ORDER BY n.ctime DESC\n                    LIMIT ?;";
             $records = get_records_sql_array($sql, array($USER->get('id'), $maxitems + 1));
         }
         // Hack to decide whether to show the More... link
         if ($showmore = count($records) > $maxitems) {
             unset($records[$maxitems]);
         }
         if ($records) {
             foreach ($records as &$r) {
                 $r->message = format_notification_whitespace($r->message, $r->type);
             }
         }
         $smartytemplate = 'blocktype:inbox:inbox.tpl';
     }
     if ($records) {
         require_once 'activity.php';
         foreach ($records as &$r) {
             $section = empty($r->plugintype) ? 'activity' : "{$r->plugintype}.{$r->pluginname}";
             $r->strtype = get_string('type' . $r->type, $section);
         }
     }
     $smarty = smarty_core();
     if ($showmore) {
         $smarty->assign('morelink', self::get_link($instance) . '?type=' . implode(',', $desiredtypes));
     }
     $smarty->assign('blockid', 'blockinstance_' . $instance->get('id'));
     $smarty->assign('items', $records);
     return $smarty->fetch($smartytemplate);
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:57,代码来源:lib.php


示例4: delete_submit

 function delete_submit(Pieform $form, $values)
 {
     global $SESSION;
     $authinstanceids = get_column('auth_instance', 'id', 'institution', $values['i']);
     $viewids = get_column('view', 'id', 'institution', $values['i']);
     $artefactids = get_column('artefact', 'id', 'institution', $values['i']);
     $regdataids = get_column('institution_registration', 'id', 'institution', $values['i']);
     db_begin();
     if ($viewids) {
         require_once get_config('libroot') . 'view.php';
         foreach ($viewids as $viewid) {
             $view = new View($viewid);
             $view->delete();
         }
     }
     if ($artefactids) {
         foreach ($artefactids as $artefactid) {
             try {
                 $a = artefact_instance_from_id($artefactid);
                 $a->delete();
             } catch (ArtefactNotFoundException $e) {
                 // Awesome, it's already gone.
             }
         }
     }
     // If any users are still using this institution's authinstances, change them now.
     if ($authinstanceids) {
         execute_sql("\n                    UPDATE {usr}\n                    SET authinstance = (\n                        SELECT MIN(id) FROM {auth_instance} WHERE institution = 'mahara' AND authname = 'internal'\n                    )\n                    WHERE authinstance IN (" . join(',', array_fill(0, count($authinstanceids), '?')) . ')', $authinstanceids);
     }
     foreach ($authinstanceids as $id) {
         delete_records('auth_instance_config', 'instance', $id);
     }
     foreach ($regdataids as $id) {
         delete_records('institution_registration_data', 'registration_id', $id);
     }
     // The institution should have been removed from favourites lists when the members were removed,
     // but make sure it's gone.
     execute_sql('DELETE FROM {favorite_usr} WHERE favorite IN (SELECT id FROM {favorite} WHERE institution = ?)', array($values['i']));
     delete_records('favorite', 'institution', $values['i']);
     execute_sql("UPDATE {group} SET institution = NULL, shortname = NULL WHERE institution = ?", array($values['i']));
     delete_records('auth_instance', 'institution', $values['i']);
     delete_records('host', 'institution', $values['i']);
     delete_records('institution_locked_profile_field', 'name', $values['i']);
     delete_records('usr_institution_request', 'institution', $values['i']);
     delete_records('view_access', 'institution', $values['i']);
     delete_records('institution_data', 'institution', $values['i']);
     delete_records('institution_registration', 'institution', $values['i']);
     delete_records('institution', 'name', $values['i']);
     db_commit();
     $SESSION->add_ok_msg(get_string('institutiondeletedsuccessfully', 'admin'));
     redirect('/admin/users/institutions.php');
 }
开发者ID:nanda555,项目名称:TestAppFromAWS,代码行数:52,代码来源:institutions.php


示例5: submitview_submit

function submitview_submit(Pieform $form, $values)
{
    global $SESSION, $USER, $viewid, $groupid, $group;
    db_begin();
    update_record('view', array('submittedgroup' => $groupid, 'submittedtime' => db_format_timestamp(time())), array('id' => $viewid));
    $roles = get_column('grouptype_roles', 'role', 'grouptype', $group->grouptype, 'see_submitted_views', 1);
    foreach ($roles as $role) {
        $accessrecord = (object) array('view' => $viewid, 'group' => $groupid, 'role' => $role, 'visible' => 0, 'allowcomments' => 1, 'approvecomments' => 0);
        ensure_record_exists('view_access', $accessrecord, $accessrecord);
    }
    ArtefactType::update_locked($USER->get('id'));
    activity_occurred('groupmessage', array('subject' => get_string('viewsubmitted', 'view'), 'message' => get_string('viewsubmitted', 'view'), 'submittedview' => $viewid, 'viewowner' => $USER->get('id'), 'group' => $groupid, 'roles' => $roles, 'strings' => (object) array('urltext' => (object) array('key' => 'view'))));
    db_commit();
    $SESSION->add_ok_msg(get_string('viewsubmitted', 'view'));
    redirect('/' . returnto());
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:16,代码来源:submit.php


示例6: delete_submit

 function delete_submit(Pieform $form, $values)
 {
     global $SESSION;
     $authinstanceids = get_column('auth_instance', 'id', 'institution', $values['i']);
     db_begin();
     foreach ($authinstanceids as $id) {
         delete_records('auth_instance_config', 'instance', $id);
         execute_sql('UPDATE {usr} SET lastauthinstance = NULL WHERE lastauthinstance = ?', array($id));
     }
     delete_records('auth_instance', 'institution', $values['i']);
     delete_records('host', 'institution', $values['i']);
     delete_records('institution_locked_profile_field', 'name', $values['i']);
     delete_records('usr_institution_request', 'institution', $values['i']);
     delete_records('institution', 'name', $values['i']);
     db_commit();
     $SESSION->add_ok_msg(get_string('institutiondeletedsuccessfully', 'admin'));
     redirect('/admin/users/institutions.php');
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:18,代码来源:institutions.php


示例7: requestjoingroup_submit

function requestjoingroup_submit(Pieform $form, $values)
{
    global $SESSION, $USER, $group, $goto;
    insert_record('group_member_request', (object) array('group' => $group->id, 'member' => $USER->get('id'), 'ctime' => db_format_timestamp(time()), 'reason' => isset($values['reason']) ? $values['reason'] : null));
    // Send request to all group admins
    require_once 'activity.php';
    $groupadmins = get_column('group_member', 'member', 'group', $group->id, 'role', 'admin');
    foreach ($groupadmins as $groupadmin) {
        $adminlang = get_user_language($groupadmin);
        if (isset($values['reason']) && $values['reason'] != '') {
            $message = get_string_from_language($adminlang, 'grouprequestmessagereason', 'group', display_name($USER, get_record('usr', 'id', $groupadmin)), $group->name, $values['reason']);
        } else {
            $message = get_string_from_language($adminlang, 'grouprequestmessage', 'group', display_name($USER, get_record('usr', 'id', $groupadmin)), $group->name);
        }
        activity_occurred('maharamessage', array('users' => array($groupadmin), 'subject' => get_string_from_language($adminlang, 'grouprequestsubject', 'group'), 'message' => $message, 'url' => 'group/members.php?id=' . $group->id . '&membershiptype=request', 'strings' => (object) array('urltext' => (object) array('key' => 'pendingmembers', 'section' => 'group'))));
    }
    $SESSION->add_ok_msg(get_string('grouprequestsent', 'group'));
    redirect($goto);
}
开发者ID:patkira,项目名称:mahara,代码行数:19,代码来源:requestjoin.php


示例8: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $USER;
     $configdata = $instance->get('configdata');
     $desiredtypes = array();
     foreach ($configdata as $k => $v) {
         if (!empty($v) && $k != 'maxitems') {
             $type = preg_replace('/[^a-z]+/', '', $k);
             $desiredtypes[$type] = $type;
         }
     }
     if ($USER->get('admin') && !empty($desiredtypes['adminmessages'])) {
         unset($desiredtypes['adminmessages']);
         $desiredtypes += get_column('activity_type', 'name', 'admin', 1);
     }
     $maxitems = isset($configdata['maxitems']) ? $configdata['maxitems'] : 5;
     $records = array();
     if ($desiredtypes) {
         $sql = "\n                SELECT n.id, n.subject, n.message, n.url, n.urltext, n.read, t.name AS type\n                FROM {notification_internal_activity} n JOIN {activity_type} t ON n.type = t.id\n                WHERE n.usr = ?\n                AND t.name IN (" . join(',', array_map('db_quote', $desiredtypes)) . ")\n                ORDER BY n.ctime DESC\n                LIMIT ?;";
         $records = get_records_sql_array($sql, array($USER->get('id'), $maxitems + 1));
     }
     // Hack to decide whether to show the More... link
     if ($showmore = count($records) > $maxitems) {
         unset($records[$maxitems]);
     }
     if ($records) {
         require_once 'activity.php';
         foreach ($records as &$r) {
             $r->message = format_notification_whitespace($r->message, $r->type);
         }
     }
     $smarty = smarty_core();
     if ($showmore) {
         $smarty->assign('desiredtypes', implode(',', $desiredtypes));
     }
     $smarty->assign('blockid', 'blockinstance_' . $instance->get('id'));
     $smarty->assign('items', $records);
     return $smarty->fetch('blocktype:inbox:inbox.tpl');
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:39,代码来源:lib.php


示例9: instance_config_save

 public static function instance_config_save($instance, $values)
 {
     db_begin();
     // Autosubscribe
     delete_records_sql("DELETE FROM {interaction_forum_instance_config}\n            WHERE field = 'autosubscribe' AND forum = ?", array($instance->get('id')));
     insert_record('interaction_forum_instance_config', (object) array('forum' => $instance->get('id'), 'field' => 'autosubscribe', 'value' => (bool) $values['autosubscribe']));
     if ($values['justcreated'] && $values['autosubscribe']) {
         // Subscribe all existing users in the group to the forums
         if ($userids = get_column('group_member', 'member', 'group', $instance->get('group'))) {
             foreach ($userids as $userid) {
                 insert_record('interaction_forum_subscription_forum', (object) array('forum' => $instance->get('id'), 'user' => $userid));
             }
         }
     }
     // Moderators
     delete_records('interaction_forum_moderator', 'forum', $instance->get('id'));
     foreach ($values['moderator'] as $user) {
         insert_record('interaction_forum_moderator', (object) array('user' => $user, 'forum' => $instance->get('id')));
     }
     // Re-order the forums according to their new ordering
     delete_records_sql('DELETE FROM {interaction_forum_instance_config}
         WHERE field = \'weight\' AND forum IN (
             SELECT id FROM {interaction_instance} WHERE "group" = ?
         )', array($instance->get('group')));
     if (isset($values['weight'])) {
         foreach ($values['weight'] as $weight => $id) {
             if ($id === null) {
                 // This is where the current forum is to be placed
                 $id = $instance->get('id');
             }
             insert_record('interaction_forum_instance_config', (object) array('forum' => $id, 'field' => 'weight', 'value' => $weight));
         }
     } else {
         // Element was ignored - because this is the first forum in a group
         insert_record('interaction_forum_instance_config', (object) array('forum' => $instance->get('id'), 'field' => 'weight', 'value' => 0));
     }
     db_commit();
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:38,代码来源:lib.php


示例10: delete_submit

 function delete_submit(Pieform $form, $values)
 {
     global $SESSION;
     $authinstanceids = get_column('auth_instance', 'id', 'institution', $values['i']);
     $viewids = get_column('view', 'id', 'institution', $values['i']);
     $artefactids = get_column('artefact', 'id', 'institution', $values['i']);
     db_begin();
     if ($viewids) {
         require_once get_config('libroot') . 'view.php';
         foreach ($viewids as $viewid) {
             $view = new View($viewid);
             $view->delete();
         }
     }
     if ($artefactids) {
         foreach ($artefactids as $artefactid) {
             try {
                 $a = artefact_instance_from_id($artefactid);
                 $a->delete();
             } catch (ArtefactNotFoundException $e) {
                 // Awesome, it's already gone.
             }
         }
     }
     foreach ($authinstanceids as $id) {
         delete_records('auth_instance_config', 'instance', $id);
     }
     delete_records('auth_instance', 'institution', $values['i']);
     delete_records('host', 'institution', $values['i']);
     delete_records('institution_locked_profile_field', 'name', $values['i']);
     delete_records('usr_institution_request', 'institution', $values['i']);
     delete_records('institution', 'name', $values['i']);
     db_commit();
     $SESSION->add_ok_msg(get_string('institutiondeletedsuccessfully', 'admin'));
     redirect('/admin/users/institutions.php');
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:36,代码来源:institutions.php


示例11: submit

 public function submit($group)
 {
     global $USER;
     if ($this->is_submitted()) {
         throw new SystemException('Attempting to submit a submitted view');
     }
     $group->roles = get_column('grouptype_roles', 'role', 'grouptype', $group->grouptype, 'see_submitted_views', 1);
     self::_db_submit(array($this->id), $group);
     activity_occurred('groupmessage', array('group' => $group->id, 'roles' => $group->roles, 'url' => $this->get_url(false), 'strings' => (object) array('urltext' => (object) array('key' => 'view'), 'subject' => (object) array('key' => 'viewsubmittedsubject1', 'section' => 'activity', 'args' => array($group->name)), 'message' => (object) array('key' => 'viewsubmittedmessage1', 'section' => 'activity', 'args' => array(display_name($USER, null, false, true), $this->title, $group->name)))));
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:10,代码来源:view.php


示例12: install_blocktype_extras

function install_blocktype_extras()
{
    db_begin();
    $categories = get_blocktype_categories();
    $installedcategories = get_column('blocktype_category', 'name');
    if ($toinstall = array_diff($categories, $installedcategories)) {
        foreach ($toinstall as $i) {
            insert_record('blocktype_category', (object) array('name' => $i));
        }
    }
    db_commit();
    // poll all the installed blocktype plugins and ask them what categories they export
    if ($blocktypes = plugins_installed('blocktype', true)) {
        foreach ($blocktypes as $bt) {
            install_blocktype_categories_for_plugin(blocktype_single_to_namespaced($bt->name, $bt->artefactplugin));
            install_blocktype_viewtypes_for_plugin(blocktype_single_to_namespaced($bt->name, $bt->artefactplugin));
        }
    }
}
开发者ID:Br3nda,项目名称:mahara,代码行数:19,代码来源:upgrade.php


示例13: attached_id_list

 public static function attached_id_list($attachmentid)
 {
     return get_column('artefact_attachment', 'artefact', 'attachment', $attachmentid);
 }
开发者ID:kienv,项目名称:mahara,代码行数:4,代码来源:lib.php


示例14: get_column

<?php

include '../functions.php';
$data = get_column('Career_Category', $_GET);
echo json_encode($data);
开发者ID:jyann,项目名称:pathways-program-portal,代码行数:5,代码来源:index.php


示例15: define

 */
// NOTE: This script is VERY SIMILAR to the staffusers.php script, a bug fixed
// here might need to be fixed there too.
define('INTERNAL', 1);
define('ADMIN', 1);
define('MENUITEM', 'configusers/adminusers');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('adminusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'adminusers');
require_once 'pieforms/pieform.php';
require_once 'activity.php';
// Get users who are currently administrators
// @todo later, exclude the user with uid 1
$adminusers = get_column('usr', 'id', 'admin', 1, 'deleted', 0);
$form = pieform(array('name' => 'adminusers', 'elements' => array('users' => array('type' => 'userlist', 'title' => get_string('adminusers', 'admin'), 'defaultvalue' => $adminusers, 'lefttitle' => get_string('potentialadmins', 'admin'), 'righttitle' => get_string('currentadmins', 'admin'), 'searchparams' => array('query' => '', 'limit' => 250, 'orderby' => 'lastname'), 'rules' => array('required' => true)), 'submit' => array('type' => 'submit', 'value' => get_string('submit')))));
function adminusers_submit(Pieform $form, $values)
{
    global $SESSION;
    db_begin();
    execute_sql('UPDATE {usr}
        SET admin = 0
        WHERE admin = 1');
    execute_sql('UPDATE {usr}
        SET admin = 1
        WHERE id IN (' . join(',', array_map('intval', $values['users'])) . ')');
    activity_add_admin_defaults($values['users']);
    db_commit();
    $SESSION->add_ok_msg(get_string('adminusersupdated', 'admin'));
    redirect('/admin/users/admins.php');
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:admins.php


示例16: add_user_to_autoadd_groups

/**
 * Given a user, makes sure they have been added to all groups that are marked 
 * as ones that users should be auto-added to
 *
 * @param array $eventdata Event data passed from activity_occured, the key 'id' = userid
 */
function add_user_to_autoadd_groups($eventdata)
{
    require_once 'group.php';
    $userid = $eventdata['id'];
    if ($autoaddgroups = get_column('group', 'id', 'usersautoadded', true)) {
        foreach ($autoaddgroups as $groupid) {
            if (!group_user_access($groupid, $userid)) {
                group_add_user($groupid, $userid);
            }
        }
    }
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:18,代码来源:user.php


示例17: group_get_grouptypes

/**
 * Returns a list of available grouptypes
 *
 * @return array
 */
function group_get_grouptypes()
{
    static $grouptypes = null;
    if (is_null($grouptypes)) {
        $grouptypes = get_column('grouptype', 'name');
    }
    return $grouptypes;
}
开发者ID:vohung96,项目名称:mahara,代码行数:13,代码来源:group.php


示例18: copy

 /**
  * Builds a new block instance as a copy of this one, taking into account
  * the Views being copied from and to.
  *
  * Blocktypes can decide whether they want to be copied to the new View. The
  * return value of this method should indicate whether the blocktype was
  * copied or not.
  *
  * @param View $view The view that this new blockinstance is being created for
  * @param View $template The view that this (the old) blockinstance comes from
  * @param array $artefactcopies Correspondence between original artefact IDs and IDs of copies
  * @return boolean Whether a new blockinstance was made or not.
  */
 public function copy(View $view, View $template, &$artefactcopies)
 {
     $blocktypeclass = generate_class_name('blocktype', $this->get('blocktype'));
     $configdata = $this->get('configdata');
     if (isset($configdata['copytype'])) {
         $copytype = $configdata['copytype'];
     } else {
         $copytype = call_static_method($blocktypeclass, 'default_copy_type');
     }
     $viewowner = $view->ownership();
     $templateowner = $template->ownership();
     $sameowner = $viewowner['type'] == $templateowner['type'] && $viewowner['id'] == $templateowner['id'];
     // Check to see if the block is allowed to be copied into the new View
     //
     // Note for later: this is Blockinstance->allowed_in_view. This
     // determines whether this blockinstance should be copied into a view.
     // This could be a different question from BlockType::allowed_in_view!
     // But for now they use the same method.
     if (!call_static_method($blocktypeclass, 'allowed_in_view', $view)) {
         return false;
     }
     if ($copytype == 'nocopy' && !$sameowner) {
         return false;
     }
     $newblock = new BlockInstance(0, array('blocktype' => $this->get('blocktype'), 'title' => $this->get('title'), 'view' => $view->get('id'), 'view_obj' => $view, 'row' => $this->get('row'), 'column' => $this->get('column'), 'order' => $this->get('order')));
     if ($sameowner || $copytype == 'reference') {
         $newblock->set('configdata', $configdata);
         $newblock->commit();
         return true;
     }
     $artefactids = get_column('view_artefact', 'artefact', 'block', $this->get('id'));
     if (!empty($artefactids) && $copytype == 'full') {
         // Copy artefacts & put the new artefact ids into the new block.
         // Artefacts may have children (defined using the parent column of the artefact table) and attachments (currently
         // only for blogposts).  If we copy an artefact we must copy all its descendents & attachments too.
         $descendants = artefact_get_descendants($artefactids);
         // We need the artefact instance before we can get its attachments
         $tocopy = array();
         $attachmentlists = array();
         $embedlists = array();
         foreach ($descendants as $d) {
             if (!isset($artefactcopies[$d])) {
                 $tocopy[$d] = artefact_instance_from_id($d);
                 // Get attachments.
                 $attachmentlists[$d] = $tocopy[$d]->attachment_id_list();
                 foreach ($attachmentlists[$d] as $a) {
                     if (!isset($artefactcopies[$a]) && !isset($tocopy[$a])) {
                         $tocopy[$a] = artefact_instance_from_id($a);
                     }
                 }
                 // Get embedded file artefacts
                 $embedlists[$d] = $tocopy[$d]->embed_id_list();
                 foreach ($embedlists[$d] as $a) {
                     if (!isset($artefactcopies[$a]) && !isset($tocopy[$a])) {
                         $tocopy[$a] = artefact_instance_from_id($a);
                     }
                 }
             }
         }
         // Copy all the artefacts we haven't copied yet
         foreach ($tocopy as $aid => $a) {
             // Save the id of the original artefact's parent
             $artefactcopies[$aid] = (object) array('oldid' => $aid, 'oldparent' => $a->get('parent'));
             if (!empty($attachmentlists[$aid])) {
                 $artefactcopies[$aid]->oldattachments = $attachmentlists[$aid];
             }
             if (!empty($embedlists[$aid])) {
                 $artefactcopies[$aid]->oldembeds = $embedlists[$aid];
             }
             $artefactcopies[$aid]->newid = $a->copy_for_new_owner($view->get('owner'), $view->get('group'), $view->get('institution'));
         }
         // Record new artefact ids in the new block
         if (isset($configdata['artefactid'])) {
             $configdata['artefactid'] = $artefactcopies[$configdata['artefactid']]->newid;
         }
         if (isset($configdata['artefactids'])) {
             foreach ($configdata['artefactids'] as &$oldid) {
                 $oldid = $artefactcopies[$oldid]->newid;
             }
         }
     } else {
         $configdata = call_static_method($blocktypeclass, 'rewrite_blockinstance_config', $view, $configdata);
     }
     // Rewrite the extra configuration of block
     $configdata = call_static_method($blocktypeclass, 'rewrite_blockinstance_extra_config', $view, $newblock, $configdata, $artefactcopies);
     $newblock->set('configdata', $configdata);
     $newblock->commit();
//.........这里部分代码省略.........
开发者ID:sarahjcotton,项目名称:mahara,代码行数:101,代码来源:lib.php


示例19: addviews_submit

function addviews_submit(Pieform $form, $values)
{
    global $SESSION, $collection;
    // Check if the existing view permissions are different from the views being added
    $viewids = get_column('collection_view', 'view', 'collection', $collection->get('id'));
    $firstviewaccess = array();
    if (count($viewids)) {
        $firstview = new View($viewids[0]);
        $firstviewaccess = $firstview->get_access();
    }
    $chosen = array();
    foreach ($values as $key => $value) {
        if (substr($key, 0, 5) === 'view_' and $value == true) {
            $chosen[] = substr($key, 5);
        }
    }
    // New view permissions
    $collectiondifferent = false;
    $different = false;
    $differentarray = array();
    foreach ($chosen as $viewid) {
        $view = new View($viewid);
        $viewaccess = $view->get_access();
        if (!empty($firstviewaccess) && empty($viewaccess)) {
            // adding the collection access rules to the added pages
            $different = true;
            $differentarray[] = $viewid;
        } else {
            if (!empty($firstviewaccess)) {
                $merged = combine_arrays($firstviewaccess, $viewaccess);
                if ($merged != $firstviewaccess) {
                    // adding the new access rules to both collection and added pages
                    $different = true;
                    $collectiondifferent = true;
                    $differentarray[] = $viewid;
                } else {
                    if ($merged != $viewaccess) {
                        // adding collection access rules to the added pages
                        $different = true;
                        $differentarray[] = $viewid;
                    }
                }
            } else {
                if (empty($firstviewaccess) && !empty($viewaccess)) {
                    // adding the page's access rules to the collection pages
                    $different = true;
                    $collectiondifferent = true;
                }
            }
        }
    }
    $count = $collection->add_views($values);
    if ($collectiondifferent) {
        $differentarray = array_merge($differentarray, $viewids);
    }
    if ($different) {
        $SESSION->set('pageaccesschanged', $differentarray);
        $SESSION->set('pagesadded', $count);
    } else {
        $SESSION->add_ok_msg(get_string('viewsaddedtocollection1', 'collection', $count));
    }
    redirect('/collection/views.php?id=' . $collection->get('id'));
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:63,代码来源:views.php


示例20: __construct

 /**
  * @param array $data Parameters:
  *                    - message (string)
  *                    - view (int)
  *                    - artefact (int) (optional)
  *                    - reporter (int)
  *                    - ctime (int) (optional)
  */
 function __construct($data, $cron = false)
 {
     parent::__construct($data, $cron);
     require_once 'view.php';
     $this->view = new View($this->view);
     if (!empty($this->artefact)) {
         require_once get_config('docroot') . 'artefact/lib.php';
         $this->artefact = artefact_instance_from_id($this->artefact);
     }
     if ($owner = $this->view->get('owner')) {
         // Notify institutional admins of the view owner
         if ($institutions = get_column('usr_institution', 'institution', 'usr', $owner)) {
             $this->users = activity_get_users($this->get_id(), null, null, null, $institutions);
         }
     }
     if (empty($this->artefact)) {
         $this->url = $this->view->get_url(false);
     } else {
         $this->url = 'artefact/artefact.php?artefact=' . $this->artefact->get('id') . '&view=' . $this->view->get('id');
     }
     if (empty($this->strings->subject)) {
         $this->overridemessagecontents = true;
         $viewtitle = $this->view->get('title');
         $this->strings = new stdClass();
         if (empty($this->artefact)) {
             $this->strings->subject = (object) array('key' => 'objectionablecontentview', 'section' => 'activity', 'args' => array($viewtitle, display_default_name($this->reporter)));
         } else {
             $title = $this->artefact->get('title');
             $this->strings->subject = (object) array('key' => 'objectionablecontentviewartefact', 'section' => 'activity', 'args' => array($viewtitle, $title, display_default_name($this->reporter)));
         }
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:40,代码来源:activity.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_column_headers函数代码示例发布时间:2022-05-15
下一篇:
PHP get_colored_device_status函数代码示例发布时间: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