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


PHP Group::get_by_id方法代码示例

本文整理汇总了PHP中Group::get_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::get_by_id方法的具体用法?PHP Group::get_by_id怎么用?PHP Group::get_by_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


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

示例1: select_group

 public function select_group()
 {
     $group_id = $this->input->post('group_id');
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $group = new Group();
     $group->get_by_id($group_id);
     if ($group->exists()) {
         $course = $group->course->get();
         if (is_null($course->groups_change_deadline) || date('U', strtotime($course->groups_change_deadline)) >= time()) {
             $student = new Student();
             $student->get_by_id($this->usermanager->get_student_id());
             if ($student->is_related_to('active_course', $course->id)) {
                 $participant = new Participant();
                 $participant->where_related($student);
                 $participant->where_related($course);
                 $participant->where('allowed', 1);
                 $participant->get();
                 if ($participant->exists()) {
                     if (!$participant->is_related_to($group)) {
                         $participant->save($group);
                         $participant->where_related($course);
                         $participant->where_related($group);
                         $participant->where('allowed', 1);
                         $participants_count = $participant->count();
                         $room = new Room();
                         $room->where_related($group)->order_by('capacity', 'asc')->limit(1)->get();
                         if ($participants_count > intval($room->capacity)) {
                             $this->db->trans_rollback();
                             $this->messages->add_message('lang:groups_message_group_is_full', Messages::MESSAGE_TYPE_ERROR);
                         } else {
                             $this->db->trans_commit();
                             $this->messages->add_message(sprintf($this->lang->line('groups_message_group_changed'), $this->lang->text($group->name)), Messages::MESSAGE_TYPE_SUCCESS);
                             $this->_action_success();
                             $this->output->set_internal_value('course_id', $participant->course_id);
                         }
                     } else {
                         $this->db->trans_rollback();
                         $this->messages->add_message('lang:groups_message_you_are_in_group', Messages::MESSAGE_TYPE_ERROR);
                     }
                 } else {
                     $this->db->trans_rollback();
                     $this->messages->add_message('lang:groups_message_cant_found_participant_record', Messages::MESSAGE_TYPE_ERROR);
                 }
             } else {
                 $this->db->trans_rollback();
                 $this->messages->add_message('lang:groups_message_cant_change_group_of_inactive_course', Messages::MESSAGE_TYPE_ERROR);
             }
         } else {
             $this->db->trans_rollback();
             $this->messages->add_message('lang:groups_message_groups_switching_disabled', Messages::MESSAGE_TYPE_ERROR);
         }
     } else {
         $this->db->trans_rollback();
         $this->messages->add_message('lang:groups_message_group_not_found', Messages::MESSAGE_TYPE_ERROR);
     }
     redirect(create_internal_url('groups'));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:58,代码来源:groups.php

示例2: header

 *
 * License: http://www.plupload.com/license
 * Contributing: http://www.plupload.com/contributing
 */
require_once "../includes/initialize.php";
global $session;
// HTTP headers for no cache etc
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$folder = $_GET['folder'];
// Settings
//$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
$targetDir = 'groups/' . Group::get_by_id($session->user_group_id)->name . '/files/' . $folder . '/';
$cleanupTargetDir = true;
// Remove old files
$maxFileAge = 5 * 3600;
// Temp file age in seconds
// 5 minutes execution time
@set_time_limit(5 * 60);
// Uncomment this one to fake upload time
// usleep(5000);
// Get parameters
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
// Clean the fileName for security reasons
$fileName = preg_replace('/[^\\w\\._]+/', '_', $fileName);
// Make sure the fileName is unique but only if chunking is disabled
开发者ID:NemOry,项目名称:BundledFunWebPanel,代码行数:31,代码来源:upload.php

示例3: die

if (!$session->is_logged_in()) {
    die("you can't touch this page");
}
if ($what == "user") {
    foreach ($ids as $id) {
        User::get_by_id($id)->delete();
    }
    $response = "success";
} else {
    if ($what == "question") {
        foreach ($ids as $id) {
            Question::get_by_id($id)->delete();
        }
        $response = "success";
    } else {
        if ($what == "group") {
            foreach ($ids as $id) {
                Group::get_by_id($id)->delete();
            }
            $response = "success";
        } else {
            if ($what == "score") {
                foreach ($ids as $id) {
                    Score::get_by_id($id)->delete();
                }
                $response = "success";
            }
        }
    }
}
echo $response;
开发者ID:NemOry,项目名称:BundledFunWebPanel,代码行数:31,代码来源:multi_delete.php

示例4: new_room_form

 public function new_room_form($group_id)
 {
     $group = new Group();
     $group->get_by_id($group_id);
     smarty_inject_days();
     $this->inject_teachers();
     $this->parser->parse('backend/rooms/new_room_form.tpl', array('group' => $group, 'group_id' => $group_id));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:8,代码来源:rooms.php

示例5: error_reporting

/*
 * jQuery File Upload Plugin PHP Example 5.7
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2010, Sebastian Tschan
 * https://blueimp.net
 *
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/MIT
 */
error_reporting(E_ALL | E_STRICT);
require 'upload.class.php';
require_once "../../includes/initialize.php";
global $session;
$group = Group::get_by_id($session->user_group_id);
$upload_handler = new UploadHandler($group, "questions");
header('Pragma: no-cache');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Content-Disposition: inline; filename="files.json"');
header('X-Content-Type-Options: nosniff');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
switch ($_SERVER['REQUEST_METHOD']) {
    case 'OPTIONS':
        break;
    case 'HEAD':
    case 'GET':
        $upload_handler->get();
        break;
开发者ID:NemOry,项目名称:BundledFunWebPanel,代码行数:30,代码来源:question_uploader.php

示例6: Group

 function message_owner()
 {
     $group = new Group();
     $group->get_by_id($this->group_id);
     if ($group->name) {
         return $group->name;
     }
     $user = new User();
     $user->get_by_id($this->user_id);
     return $user->full_name();
 }
开发者ID:hharrysidhu,项目名称:OpenVBX,代码行数:11,代码来源:vbx_message.php

示例7: header

<?php

require_once "header.php";
if (isset($_GET['id'])) {
    $object = Group::get_by_id($_GET['id']);
    if ($object == false || $object == null || $object == "") {
        header("location: index.php");
    }
} else {
    header("location: index.php?negative");
}
if (!$session->is_logged_in()) {
    header("location: index.php?negative");
} else {
    $user = User::get_by_id($session->user_id);
    if ($user->enabled == DISABLED) {
        header("location: index.php?disabled");
    }
    if (!ClubUser::amIAdmin($session->user_id, $object->id) && !$user->is_super_admin()) {
        header("location: index.php?negative");
    }
}
$pathinfo = pathinfo($_SERVER["PHP_SELF"]);
$basename = $pathinfo["basename"];
$currentFile = str_replace(".php", "", $basename);
?>
<div class="container-fluid">
  <div class="row-fluid">
    <div class="span1"></div>
    <div class="span9">
      <form id="theform" class="form-horizontal" method="post" action="#" enctype="multipart/form-data">
开发者ID:NemOry,项目名称:Skoolyf,代码行数:31,代码来源:updategroup.php

示例8: update_person

 public function update_person($person_id = NULL)
 {
     if (is_null($person_id)) {
         add_error_flash_message('Osoba sa nenašla.');
         redirect(site_url('persons'));
     }
     $this->db->trans_begin();
     $person = new Person();
     $person->get_by_id((int) $person_id);
     if (!$person->exists()) {
         $this->db->trans_rollback();
         add_error_flash_message('Osoba sa nenašla.');
         redirect(site_url('persons'));
     }
     $form = $this->get_edit_form($person);
     build_validator_from_form($form);
     if ($this->form_validation->run()) {
         $person_data = $this->input->post('person');
         if (auth_get_id() == $person->id && $person_data['admin'] != 1) {
             $this->db->trans_rollback();
             add_error_flash_message('Nie je možné odobrať oprávnenie administrátora vlastnému účtu.');
             redirect(site_url('persons/edit_person/' . $person->id));
         }
         if (auth_get_id() == $person->id && $person_data['enabled'] != 1) {
             $this->db->trans_rollback();
             add_error_flash_message('Nie je možné odobrať oprávnenie na prihlasovanie sa vlastnému účtu.');
             redirect(site_url('persons/edit_person/' . $person->id));
         }
         if ($person_data['password'] != '') {
             $person->password = sha1($person_data['password']);
         }
         $person->from_array($person_data, array('name', 'surname', 'login', 'organisation', 'admin', 'enabled', 'number', 'email'));
         //edit
         $group = new Group();
         if ($person_data['group_id'] != '') {
             $group->get_by_id((int) $person_data['group_id']);
         }
         if ($person->save($group) && $this->db->trans_status()) {
             $this->db->trans_commit();
             add_success_flash_message('Osoba s ID <strong>' . $person->id . '</strong> bola úspešne aktualizovaná.');
             redirect(site_url('persons'));
         } else {
             $this->db->trans_rollback();
             add_error_flash_message('Osobu s ID <strong>' . $person->id . '</strong> sa nepodarilo aktualizovať.');
             redirect(site_url('persons/edit_person/' . (int) $person->id));
         }
     } else {
         $this->db->trans_rollback();
         $this->edit_person($person_id);
     }
 }
开发者ID:andrejjursa,项目名称:lstme-ledcoin,代码行数:51,代码来源:persons.php

示例9: foreach

	        <div id="uploader">
				<p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
			</div>
	    </div>

	    <h3>Files Uploaded</h3>
	    <div>
	    	<table>
			<?php 
$group = Group::get_by_id($session->user_group_id);
$directory = PUBLIC_PATH . DS . 'groups' . DS . $group->name . DS . 'files' . DS . 'users' . DS . '*';
foreach (glob($directory) as $file) {
    $name = basename($file);
    $ext = pathinfo($file, PATHINFO_EXTENSION);
    $item = "<tr>";
    $item .= "<td><a href='groups/" . Group::get_by_id($session->user_group_id)->name . "/files/users/" . $name . "'>" . $name . "</a></td>";
    $item .= "<td><a class='click-button' title=" . $name . ">Delete</a></td>";
    $item .= "</tr>";
    echo $item;
}
?>
			</table>
	    </div>
	</div>

	<script>

	$(function() {

		$(".click-button").click(function(){
开发者ID:NemOry,项目名称:BundledFunWebPanel,代码行数:30,代码来源:upload_users.php

示例10: foreach

$users = User::get_by_sql("SELECT * FROM " . T_USERS . " WHERE " . C_USER_GROUP_ID . "=" . $session->user_group_id);
$s = "<table>";
$s .= "<tr>";
// $s .= "<td>ID</td>";
$s .= "<td>GROUP</td>";
$s .= "<td>USERNAME</td>";
// $s .= "<td>LEVEL</td>";
// $s .= "<td>PASSWORD</td>";
$s .= "<td>NAME</td>";
$s .= "<td>PICTURE</td>";
// $s .= "<td>ACCESS TOKEN</td>";
$s .= "<td>EMAIL</td>";
// $s .= "<td>ACCESS</td>";
$s .= "</tr>";
foreach ($users as $user) {
    $s .= "<tr>";
    // $s .= "<td>". $user->id."</td>";
    $s .= "<td>" . Group::get_by_id($session->user_group_id)->name . "</td>";
    $s .= "<td>" . $user->username . "</td>";
    // $s .= "<td>". $user->level."</td>";
    // $s .= "<td>". $user->password."</td>";
    $s .= "<td>" . $user->name . "</td>";
    $image_source = "../groups/" . Group::get_by_id($session->user_group_id)->name . "/files/users/" . $user->picture;
    $s .= "<td><img src=" . $image_source . " height='30' /></td>";
    // $s .= "<td>". $user->access_token."</td>";
    $s .= "<td>" . $user->email . "</td>";
    // $s .= "<td>". $user->access."</td>";
    $s .= "</tr>";
}
$s .= "</table>";
echo $s;
开发者ID:NemOry,项目名称:BundledFunWebPanel,代码行数:31,代码来源:users.php

示例11: get_valuation_table_data

 private function get_valuation_table_data($course_id, $group_id = NULL, $condensed = FALSE)
 {
     $table_data = array('header' => array(), 'content' => array());
     $course = new Course();
     $course->get_by_id(intval($course_id));
     $group = new Group();
     $group->get_by_id((int) $group_id);
     if ($course->exists()) {
         $students = new Student();
         $students->select('id, fullname, email');
         $students->include_related('participant/group', array('id', 'name'));
         $students->where_related('participant/course', 'id', $course->id);
         $students->where_related('participant', 'allowed', 1);
         $students->order_by_as_fullname('fullname');
         if ($group->exists()) {
             $students->where_related('participant/group', 'id', (int) $group_id);
         }
         $students->get_iterated();
         $task_sets_out_of_group_ids = array(0);
         $task_sets_data = array();
         $task_sets_ids = array();
         $projects_ids = array();
         if ($group->exists()) {
             $students_filter = new Student();
             $students_filter->select('id');
             $students_filter->where_related('participant/course', 'id', $course->id);
             $students_filter->where_related('participant', 'allowed', 1);
             $students_filter->where_related('participant/group', 'id', (int) $group->id);
             $solutions_filter = new Solution();
             $solutions_filter->select('id');
             $solutions_filter->where_in_subquery('student_id', $students_filter);
             $task_sets_out_of_group = new Task_set();
             $task_sets_out_of_group->select('id');
             $task_sets_out_of_group->where_in_subquery('id', $solutions_filter);
             $task_sets_out_of_group->where('published', 1);
             $task_sets_out_of_group->get();
             $task_sets_out_of_group_ids = $task_sets_out_of_group->all_to_single_array('id');
             $task_sets_out_of_group_ids[] = 0;
         }
         $content_type_task_set = new Task_set();
         $content_type_task_set->select('id, name, content_type, group_id, task_set_type_id');
         $content_type_task_set->include_related('task_set_type', 'name');
         $content_type_task_set->include_related('group', 'name');
         $content_type_task_set->where('content_type', 'task_set');
         $content_type_task_set->where('published', 1);
         $content_type_task_set->where_related_course($course);
         $content_type_task_set->order_by_related_with_constant('task_set_type', 'name', 'asc');
         $content_type_task_set->order_by('task_set_type_id', 'asc');
         $content_type_task_set->order_by('publish_start_time', 'asc');
         if ($group->exists()) {
             $content_type_task_set->group_start();
             $content_type_task_set->group_start('', 'OR ');
             $content_type_task_set->group_start();
             $content_type_task_set->or_where('group_id', NULL);
             $content_type_task_set->or_where('group_id', (int) $group_id);
             $content_type_task_set->group_end();
             $content_type_task_set->where_subquery(0, '(SELECT COUNT(`tsp`.`id`) AS `count` FROM `task_set_permissions` tsp WHERE `tsp`.`task_set_id` = `task_sets`.`id` AND `tsp`.`enabled` = 1)');
             $content_type_task_set->group_end();
             $content_type_task_set->group_start('', 'OR ');
             $content_type_task_set->where_related('task_set_permission', 'group_id', (int) $group_id);
             $content_type_task_set->where_related('task_set_permission', 'enabled', 1);
             $content_type_task_set->group_end();
             $content_type_task_set->or_where_in('id', $task_sets_out_of_group_ids);
             $content_type_task_set->group_end();
         }
         $content_type_task_set->get();
         $header_items = array();
         if ($content_type_task_set->result_count() > 0) {
             $last_task_set_type_id = NULL;
             foreach ($content_type_task_set->all as $task_set) {
                 $permissions = new Task_set_permission();
                 $permissions->select('id, group_id');
                 $permissions->include_related('group', 'name');
                 $permissions->where_related_task_set($task_set);
                 $permissions->where('enabled', 1);
                 $permissions->get_iterated();
                 if ($permissions->result_count() > 0) {
                     $group_ids = array();
                     $group_names = array();
                     foreach ($permissions as $permission) {
                         $group_ids[] = $permission->group_id;
                         $group_names[] = $this->lang->text($permission->group_name);
                     }
                     $task_sets_data[$task_set->id] = array('group_id' => $group_ids, 'group_name' => $group_names);
                 } else {
                     $task_sets_data[$task_set->id] = array('group_id' => array($task_set->group_id), 'group_name' => $this->lang->text($task_set->group_name));
                 }
                 if ($task_set->task_set_type_id !== $last_task_set_type_id) {
                     $last_task_set_type_id = $task_set->task_set_type_id;
                     $header_items[] = array('type' => 'task_set_type', 'id' => $task_set->task_set_type_id, 'name' => $this->lang->text($task_set->task_set_type_name), 'title' => '');
                 }
                 if (!$condensed) {
                     $header_items[] = array('type' => 'task_set', 'id' => $task_set->id, 'name' => $this->lang->get_overlay_with_default('task_sets', $task_set->id, 'name', $task_set->name), 'title' => is_array($task_sets_data[$task_set->id]['group_name']) ? implode(', ', $task_sets_data[$task_set->id]['group_name']) : $task_sets_data[$task_set->id]['group_name']);
                 }
                 $task_sets_ids[] = $task_set->id;
             }
         }
         $table_data['header']['content_type_task_set'] = array('content_type_name' => $this->lang->line('admin_solutions_valuation_tables_header_content_type_task_sets'), 'items' => $header_items);
         $content_type_project = new Task_set();
         $content_type_project->where('content_type', 'project');
//.........这里部分代码省略.........
开发者ID:andrejjursa,项目名称:list-lms,代码行数:101,代码来源:solutions.php

示例12: send_deadline_notifications

 public function send_deadline_notifications($lang_idiom = NULL)
 {
     $this->load->database();
     $this->load->model('translations');
     if (!is_null($lang_idiom)) {
         $this->lang->reinitialize_for_idiom($lang_idiom);
     }
     $translations = $this->translations->get_translations_for_idiom($this->lang->get_current_idiom());
     $this->lang->add_custom_translations($translations);
     $this->lang->load('cli');
     $current_time = Date('Y-m-d H:i:s');
     $one_day_back_time = Date('Y-m-d H:i:s', strtotime('now -1 day'));
     $task_sets1 = new Task_set();
     $task_sets1->select('id, name, course_id, group_id AS common_group_id, upload_end_time AS common_upload_end_time, deadline_notified AS common_deadline_notified, deadline_notification_emails AS common_deadline_notification_emails, deadline_notification_emails_handler AS common_deadline_notification_emails_handler');
     $task_sets1->select('null AS `task_set_permission_id`', FALSE);
     $task_sets1->where('deadline_notified', 0);
     $task_sets1->where('deadline_notification_emails_handler >', 0);
     $task_sets1->group_start();
     $task_sets1->not_group_start();
     $task_sets1->where('upload_end_time', NULL);
     $task_sets1->group_end();
     $task_sets1->where('upload_end_time <', $current_time);
     $task_sets1->where('upload_end_time >=', $one_day_back_time);
     $task_sets1->group_end();
     $task_sets1->where_subquery(0, '(SELECT COUNT(`tsp`.`id`) AS `count` FROM `task_set_permissions` tsp WHERE `tsp`.`task_set_id` = `task_sets`.`id` AND `tsp`.`enabled` = 1)');
     $task_sets1->where('published', 1);
     $task_sets2 = new Task_set();
     $task_sets2->select('id, name, course_id');
     $task_sets2->include_related('task_set_permission', 'group_id', 'common');
     $task_sets2->include_related('task_set_permission', 'upload_end_time', 'common');
     $task_sets2->include_related('task_set_permission', 'deadline_notified', 'common');
     $task_sets2->include_related('task_set_permission', 'deadline_notification_emails', 'common');
     $task_sets2->include_related('task_set_permission', 'deadline_notification_emails_handler', 'common');
     $task_sets2->include_related('task_set_permission', 'id');
     $task_sets2->where_related('task_set_permission', 'enabled', 1);
     $task_sets2->where_related('task_set_permission', 'deadline_notified', 0);
     $task_sets2->where_related('task_set_permission', 'deadline_notification_emails_handler >', 0);
     $task_sets2->group_start();
     $task_sets2->not_group_start();
     $task_sets2->where_related('task_set_permission', 'upload_end_time', NULL);
     $task_sets2->group_end();
     $task_sets2->where_related('task_set_permission', 'upload_end_time <', $current_time);
     $task_sets2->where_related('task_set_permission', 'upload_end_time >=', $one_day_back_time);
     $task_sets2->group_end();
     $task_sets2->where('published', 1);
     $task_sets1->union_iterated($task_sets2, TRUE);
     $this->load->library('email');
     $sent_notifications = 0;
     foreach ($task_sets1 as $task_set) {
         if ($task_set->common_deadline_notification_emails_handler > 0) {
             $emails = trim($task_set->common_deadline_notification_emails) != '' ? explode(',', $task_set->common_deadline_notification_emails) : array();
             array_walk($emails, function (&$email, $key) {
                 $email = trim($email);
             });
             if ($task_set->common_deadline_notification_emails_handler == 1) {
                 $groups = new Group();
                 $groups->where_related('course', 'id', $task_set->course_id);
                 $groups->include_related('room/teacher', '*');
                 $groups->group_start('NOT');
                 $groups->where_related('room', 'id', null);
                 $groups->or_where_related('room/teacher', 'id', null);
                 $groups->group_end();
                 $groups->group_by_related('room/teacher', 'email');
                 if (!is_null($task_set->common_group_id)) {
                     $groups->where('id', $task_set->common_group_id);
                 }
                 $groups->get_iterated();
                 foreach ($groups as $teacher) {
                     if (trim($teacher->room_teacher_email) != '') {
                         $email = trim($teacher->room_teacher_email);
                         if (!in_array($email, $emails)) {
                             $emails[] = $email;
                         }
                     }
                 }
             }
             $group = new Group();
             if (!is_null($task_set->common_group_id)) {
                 $group->get_by_id((int) $task_set->common_group_id);
             }
             if (count($emails)) {
                 $this->email->from_system();
                 $this->email->reply_to_system();
                 $this->email->build_message_body('file:emails/cli/deadline_notification.tpl', array('task_set' => $task_set, 'group' => $group));
                 if ($this->config->item('email_multirecipient_batch_mode')) {
                     $this->email->to($emails);
                     $this->email->subject('LIST: ' . $this->lang->line('cli_deadline_notification_subject'));
                     $this->email->send();
                 } else {
                     foreach ($emails as $email) {
                         $this->email->to($email);
                         $this->email->subject('TEST');
                         $this->email->send();
                     }
                 }
                 $sent_notifications++;
                 if (!is_null($task_set->task_set_permission_id)) {
                     $task_set_permission = new Task_set_permission();
                     $task_set_permission->get_by_id($task_set->task_set_permission_id);
                     if ($task_set_permission->exists()) {
//.........这里部分代码省略.........
开发者ID:andrejjursa,项目名称:list-lms,代码行数:101,代码来源:cli.php

示例13: redirect_to

<?php

require_once "../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("index.php");
} else {
    if ($session->user_level > 0) {
        redirect_to("index.php");
    }
}
if ($_POST['oper'] == 'add') {
    $group = new Group();
    $group->name = $_POST['name'];
    $group->description = $_POST['description'];
    $group->banner = $_POST['banner'];
    $group->create();
} else {
    if ($_POST['oper'] == 'edit') {
        $group = Group::get_by_id($_POST['id']);
        $group->name = $_POST['name'];
        $group->description = $_POST['description'];
        $group->banner = $_POST['banner'];
        $group->update();
    } else {
        if ($_POST['oper'] == 'del') {
            Group::get_by_id($_POST['id'])->delete();
        }
    }
}
开发者ID:NemOry,项目名称:BundledFunWebPanel,代码行数:30,代码来源:update_group.php

示例14: init

 /**
  * Allows the creation of an Administrator
  *
  */
 function init($save = FALSE)
 {
     $first_time = $this->session->userdata('first_time');
     if (!$first_time) {
         show_error('This page can only be accessed the first time.');
     }
     $user = new User();
     if ($save) {
         $user->trans_start();
         $user->from_array($_POST, array('name', 'email', 'username', 'password', 'confirm_password'));
         $group = new Group();
         $group->get_by_id(1);
         if ($user->save($group)) {
             $user->password = $this->input->post('password');
             if (!$this->login_manager->process_login($user)) {
                 show_error('Errors: <ul><li>' . implode('</li><li>', $user->error->all) . '</li></ul><pre>' . var_export($user->error, TRUE) . '</pre>');
             }
             $this->session->unset_userdata('first_time');
             $user->trans_complete();
             redirect('welcome');
         }
     }
     $user->load_extension('htmlform');
     // ID is not included because it is not necessary
     $form_fields = array('Contact Information' => 'section', 'name' => array('label' => 'Your Name'), 'email', 'Login Information' => 'section', 'username', 'password', 'confirm_password');
     $this->load->view('template_header', array('title' => 'Set Up Your Account', 'section' => 'admin'));
     $this->load->view('admin/init', array('user' => $user, 'form_fields' => $form_fields));
     $this->load->view('template_footer');
 }
开发者ID:riosfernandes,项目名称:sooe,代码行数:33,代码来源:install.php

示例15: GroupUser

         $notification->itemtype = "clubuser";
         $notification->title = "Invites you";
         $notification->create();
         $response = "success";
     } else {
         $theuser = ClubUser::getUser($user->id, $_GET['clubid']);
         if ($theuser->pending == 0) {
             $response = "This user is already a member.";
         } else {
             $response = "This user is already pending.";
         }
     }
 } else {
     if (isset($_GET['groupid'])) {
         if (!GroupUser::userExists($user->id, $_GET['groupid'])) {
             $group = Group::get_by_id($_GET['groupid']);
             $object = new GroupUser();
             $object->userid = $user->id;
             $object->groupid = $group->id;
             $object->level = 0;
             $object->role = "student";
             $object->enabled = 1;
             $object->pending = 1;
             $object->create();
             $notification = new Notification();
             $notification->fromuserid = $session->user_id;
             $notification->touserid = $user->id;
             $notification->itemid = $object->id;
             $notification->itemtype = "groupuser";
             $notification->title = "Invites you";
             $notification->create();
开发者ID:NemOry,项目名称:Skoolyf,代码行数:31,代码来源:invite.php


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