本文整理汇总了PHP中Section::get_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::get_by_id方法的具体用法?PHP Section::get_by_id怎么用?PHP Section::get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::get_by_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printS
function printS($id)
{
$ci =& get_instance();
$s = new Section();
$s->get_by_id($id);
$s->e = anchor($ci->app->app_url('edit/') . $s->id, 'Edit');
$s->d = anchor($ci->app->app_url('delete/') . $s->id, 'Delete');
$output = "<li>";
$output .= $s->id . '|';
$output .= $s->name;
$output .= add($id, 0, "add first child for {$s->name}");
$output .= '|';
$output .= $s->e;
$output .= '|';
$output .= $s->d;
$c = new Section();
$c->where('parent_section', $id);
$c->order_by('sort', 'asc');
$c->get();
if (count($c->all) > 0) {
$output .= "<ul>";
foreach ($c->all as $item) {
$output .= printS($item->id);
$output .= "<li>" . add($id, $item->sort + 1) . "</li>";
}
$output .= "</ul>";
}
$output .= "</li>";
return $output;
}
示例2: Section
function get_parents()
{
$c = new Section();
$c->get_by_id($this->id);
$parents = array();
while (!empty($c->parent_section)) {
$c = $c->get_by_id($c->parent_section);
array_push($parents, $c->id);
}
return $parents;
}
示例3: Section
function get_section()
{
$CI =& get_instance();
$sec = new Section();
$section_segment = $CI->uri->segment(1);
if (substr($section_segment, 0, 1) == '+') {
$sec->get_by_name(substr($section_segment, 1));
} else {
$sec->get_by_id($section_segment);
}
if (!$sec->exists()) {
$sec->get_by_id('1');
}
return $sec;
}
示例4: Section
function get_section()
{
$CI =& get_instance();
if ($this->installed()) {
if (!isset($CI->uri)) {
$CI->load->library('URI');
}
$sec = new Section();
$sec->get_by_id($CI->uri->segment(1));
if (!$sec->exists()) {
$sec->get();
}
return $sec;
}
}
示例5: File
<?php
require_once "../initialize.php";
$message = "";
if (isset($_POST['sectionid']) && $_POST['sectionid'] != "" && isset($_POST['batchselect']) && $_POST['batchselect'] != "" && isset($_POST['name']) && $_POST['name'] != "") {
$object = Section::get_by_id($_POST['sectionid']);
$batch = Batch::get_by_id($_POST['batchselect']);
$file = new File($_FILES['cover']);
if ($file->valid) {
$object->picture = $file->data;
} else {
$object->picture = base64_decode($object->picture);
}
if ($object->name == $_POST['name'] && $object->batchid == $batch->id) {
$object->comments = $_POST['comments'];
$object->about = $_POST['about'];
$object->advisermessage = $_POST['advisermessage'];
$object->comments = $_POST['comments'];
$object->fbcomments = $_POST['fbcomments'];
$object->enabled = $_POST['enabled'];
$object->update();
$log = new Log($session->user_id, $clientip, "WEB", "UPDATED SECTION: " . $object->id);
$log->create();
$message = "success";
} else {
if ($batch != false && $batch != null && $batch != "") {
if (!Section::section_exists($_POST['name'], $batch->id)) {
$object->batchid = $batch->id;
$object->name = $_POST['name'];
$object->about = $_POST['about'];
$object->advisermessage = $_POST['advisermessage'];
示例6: BatchUser
$schooluser->enabled = 1;
$schooluser->pending = 0;
$schooluser->create();
if (isset($_POST['batchselect']) && $_POST['batchselect'] != "NOTHING") {
$batch = Batch::get_by_id($_POST['batchselect']);
$batchuser = new BatchUser();
$batchuser->schoolid = $school->id;
$batchuser->batchid = $batch->id;
$batchuser->userid = $object->id;
$batchuser->level = 0;
$batchuser->enabled = 1;
$batchuser->pending = 0;
$batchuser->create();
}
if (isset($_POST['sectionselect']) && $_POST['sectionselect'] != "NOTHING") {
$section = Section::get_by_id($_POST['sectionselect']);
$batch = Batch::get_by_id($section->batchid);
$sectionuser = new SectionUser();
$sectionuser->sectionid = $section->id;
$sectionuser->batchid = $batch->id;
$sectionuser->userid = $object->id;
$sectionuser->schoolid = $school->id;
$sectionuser->level = 0;
$sectionuser->enabled = 1;
$sectionuser->pending = 0;
$sectionuser->create();
}
$log = new Log($session->user_id, $clientip, "WEB", "CREATED USER: " . $object->id);
$log->create();
$message = "success";
}
示例7: foreach
}
if (count($bathsImIn) > 0) {
echo '<li class="divider"> batchs</li>';
foreach ($bathsImIn as $theuser) {
$batch = Batch::get_by_id($theuser->batchid);
if (!$batch) {
$theuser->delete();
}
$school = School::get_by_id($batch->schoolid);
echo '<li><a href="#" onclick="invite(\'batchid\', ' . $batch->id . '); return false;">' . $school->name . ' - ' . $batch->get_batchyear() . '</a></li>';
}
}
if (count($sectionsImIn) > 0) {
echo '<li class="divider"> sections</li>';
foreach ($sectionsImIn as $theuser) {
$section = Section::get_by_id($theuser->sectionid);
if (!$section) {
$theuser->delete();
}
$school = School::get_by_id($section->schoolid);
$batch = Batch::get_by_id($section->batchid);
echo '<li><a href="#" onclick="invite(\'sectionid\', ' . $section->id . '); return false;">' . $school->name . ' - ' . $batch->get_batchyear() . ' - ' . $section->name . '</a></li>';
}
}
echo '
</ul>
</div>
';
}
if ($loggeduser->is_super_admin() || $loggeduser->id == $user->id) {
echo '
示例8: SectionUser
$notification->itemtype = "batchuser";
$notification->title = "Invites you";
$notification->create();
$response = "success";
} else {
$theuser = BatchUser::getUser($user->id, $_GET['batchid']);
if ($theuser->pending == 0) {
$response = "This user is already a member.";
} else {
$response = "This user is already pending.";
}
}
} else {
if (isset($_GET['sectionid'])) {
if (!SectionUser::userExists($user->id, $_GET['sectionid'])) {
$section = Section::get_by_id($_GET['sectionid']);
$batch = Batch::get_by_id($section->batchid);
$school = School::get_by_id($batch->schoolid);
$object = new SectionUser();
$object->userid = $user->id;
$object->schoolid = $school->id;
$object->batchid = $batch->id;
$object->sectionid = $section->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;
示例9: Section
<?php
$ci =& get_instance();
$s = new Section();
$s->get_by_id($ci->input->post('id'));
$s->name = $ci->input->post('name');
$s->view = $ci->input->post('view');
$s->save();
redirect($ci->app->app_url('view'));
示例10: foreach
foreach ($sectionadmins as $sectionadmin) {
$section = Section::get_by_id($sectionadmin->sectionid);
$sectionsselect .= "<option value='" . $section->id . "'>" . $section->name . "</option>";
}
if (User::get_by_id($session->user_id)->is_super_admin()) {
$sectionsselect .= "<option value='NOTHING'>NOTHING</option>";
}
} else {
$sectionsselect .= "<option value='0'>NO SECTIONS YET</option>";
}
}
} else {
$sectionadmins = SectionUser::getAdminSections($session->user_id);
if (count($sectionadmins) > 0) {
foreach ($sectionadmins as $sectionadmin) {
$section = Section::get_by_id($sectionadmin->sectionid);
$sectionsselect .= "<option value='" . $section->id . "'>" . $section->name . "</option>";
}
if (User::get_by_id($session->user_id)->is_super_admin()) {
$sectionsselect .= "<option value='NOTHING'>NOTHING</option>";
}
} else {
$sectionsselect .= "<option value='0'>NO SECTIONS YET</option>";
}
}
if (User::get_by_id($session->user_id)->is_super_admin()) {
$sectionsselect = "";
$sections = Section::get_all();
if (count($sections) > 0) {
foreach ($sections as $section) {
$sectionsselect .= "<option value='" . $section->id . "'>" . $section->name . "</option>";
示例11: Log
} else {
if ($_POST['oper'] == 'edit') {
$section = Section::get_by_id($_POST['id']);
$section->name = $_POST['name'];
$section->comments = $_POST['comments'];
$section->about = $_POST['about'];
$section->pending = $_POST['pending'];
$section->enabled = $_POST['enabled'];
$section->sectionname = $_POST['sectionname'];
$section->schoolid = $_POST['schoolid'];
$section->update();
$log = new Log($session->user_id, $clientip, "WEB", "UPDATED SECTION: " . $_POST['id']);
$log->create();
} else {
if ($_POST['oper'] == 'del') {
$section = Section::get_by_id($_POST['id']);
$school = School::get_by_id($section->schoolid);
$batch = Batch::get_by_id($section->batchid);
SectionUser::delete_all_by_sectionid($section->id);
$section->delete();
$log = new Log($session->user_id, $clientip, "WEB", "DELETED SECTION: " . $_POST['id']);
$log->create();
}
}
}
function rrmdir($dir)
{
foreach (glob($dir . '/*') as $file) {
if (is_dir($file)) {
rrmdir($file);
} else {
示例12: header
<?php
require_once "header.php";
if (isset($_GET['id'])) {
$object = Section::get_by_id($_GET['id']);
if ($object == false || $object == null || $object == "") {
header("location: index.php");
} else {
$batch = Batch::get_by_id($object->batchid);
$school = School::get_by_id($batch->schoolid);
}
} 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 (!SchoolUser::amIAdmin($session->user_id, $object->schoolid) && !BatchUser::amIAdmin($session->user_id, $object->batchid) && !SectionUser::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">
示例13: Section
<?php
$ci =& get_instance();
$ci->load->library('gui');
$id = $ci->uri->segment(5);
$s = new Section();
$s->get_by_id($id);
$hidden = array('id' => $id, 'parent_section' => $s->parent_section, 'sort' => $s->sort);
echo $ci->gui->form($ci->app->app_url('editaction'), array('Name :' => $ci->gui->textbox('name', $s->name), 'view' => $ci->gui->textarea('view', $s->view), '' => $ci->gui->button('', 'Edit Section', array('type' => 'submit'))), '', $hidden);
示例14: Content
<?php
$content_id = $ci->uri->segment(5);
$content_ins = new Content();
$content_ins->get_by_id($content_id);
if (!$content_ins->exists()) {
show_error('content not found');
}
$parent_content = new Content();
$parent_content->get_by_id($content_ins->parent_content);
$parent_section = new Section();
$parent_section->get_by_id($content_ins->parent_section);
$data_table = array('Content ID' => $content_ins->id, 'Content path' => $content_ins->path, 'Section' => empty($parent_section->name) ? 'Index' : $parent_section->name, 'Subsections' => $content_ins->subsection ? 'Yes' : 'No', 'Parent' => $parent_content->path, 'Cell' => $content_ins->cell, 'Sort' => $content_ins->sort);
$ci->load->library('gui');
$ci->app->add_info('Content information and the containers');
echo $ci->gui->form('#', $data_table);
?>
<style>
label{
font-weight: bold;
}
tr{
border-bottom: 1px solid black;
}
</style>
示例15: Log
}
$log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE BATCHS");
$log->create();
$response = "success";
} else {
if ($what == "batchuser") {
foreach ($ids as $id) {
BatchUser::get_by_id($id)->delete();
}
$log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE BATCHUSERS");
$log->create();
$response = "success";
} else {
if ($what == "section") {
foreach ($ids as $id) {
Section::get_by_id($id)->delete();
}
$log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE SECTIONS");
$log->create();
$response = "success";
} else {
if ($what == "sectionuser") {
foreach ($ids as $id) {
SectionUser::get_by_id($id)->delete();
}
$log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE SECTIONUSERS");
$log->create();
$response = "success";
} else {
if ($what == "pending") {
foreach ($ids as $id) {