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


PHP get_column函数代码示例

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


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


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