當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Section::populate方法代碼示例

本文整理匯總了PHP中Section::populate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Section::populate方法的具體用法?PHP Section::populate怎麽用?PHP Section::populate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Section的用法示例。


在下文中一共展示了Section::populate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_sections

function get_sections($con, $args)
{
    $sections = array();
    if (isset($args["section_id"])) {
        $section_id = $args["section_id"];
        $sql = $con->prepare("SELECT section_name,tid,`order` FROM section WHERE section_id=?");
        $sql->bind_param("i", $section_id);
        $sql->bind_result($section_name, $tid, $order);
        $sql->execute();
        $sql->fetch();
        $sql->close();
        if (isset($section_name) && isset($tid) && isset($order)) {
            $tmp = new Section();
            $tmp->populate($section_id, $tid, $section_name, [], $order);
            $sections[] = $tmp->expose();
        }
    } else {
        if (isset($args["section_name"])) {
            $section_name = $args["section_name"];
            $sql = $con->prepare("SELECT section_id,tid,`order` FROM section WHERE section_name=?");
            $sql->bind_param("s", $section_name);
            $sql->bind_result($section_id, $tid, $order);
            $sql->execute();
            while ($sql->fetch()) {
                if (isset($section_id) && isset($tid) && isset($order)) {
                    $tmp = new Section();
                    $tmp->populate($section_id, $tid, $section_name, [], $order);
                    $sections[] = $tmp->expose();
                }
            }
            $sql->close();
        } else {
            $sql = $con->prepare("SELECT section_id,tid,section_name,`order` FROM section");
            $sql->bind_result($section_id, $tid, $section_name, $order);
            $sql->execute();
            while ($sql->fetch()) {
                if (isset($section_id) && isset($tid) && isset($section_name) && isset($order)) {
                    $tmp = new Section();
                    $tmp->populate($section_id, $tid, $section_name, [], $order);
                    $section = $tmp->expose();
                    $sections[] = $section;
                }
            }
            $sql->close();
        }
    }
    return $sections;
}
開發者ID:nathanmarianovsky,項目名稱:manualmath.com,代碼行數:48,代碼來源:section_functions.php

示例2: Right

            } else {
                $description = "Ajout d'un rang";
                $button = "Ajouter";
            }
            $tpl->assign('description', $description);
            $tpl->assign('button', $button);
            $tpl->assign('ranks', $ranks);
            break;
        case 'right':
            $rightManager = new Right();
            $sectionManager = new Section();
            $rank = new Rank();
            $rank = $rank->getById($_['id']);
            $rights = $rightManager->loadAll(array('rank' => $_['id']));
            $rightsDictionnary = array();
            foreach ($rights as $value) {
                $rightsDictionnary[$value->getSection()]['c'] = $value->getCreate();
                $rightsDictionnary[$value->getSection()]['r'] = $value->getRead();
                $rightsDictionnary[$value->getSection()]['u'] = $value->getUpdate();
                $rightsDictionnary[$value->getSection()]['d'] = $value->getDelete();
            }
            $tpl->assign('rights', $rightsDictionnary);
            $tpl->assign('sections', $sectionManager->populate('label'));
            $tpl->assign('rank', $rank);
            break;
    }
    $view = 'setting';
} else {
    exit('Vous devez être connecté');
}
require_once dirname(__FILE__) . '/footer.php';
開發者ID:kofeve,項目名稱:yana-server,代碼行數:31,代碼來源:setting.php


注:本文中的Section::populate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。