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


PHP cmsModel::insert方法代碼示例

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


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

示例1: add_perms

function add_perms($data, $type, $options = null)
{
    $model = new cmsModel();
    foreach ($data as $controller => $names) {
        foreach ($names as $name) {
            if (!$model->db->getRowsCount('perms_rules', "controller = '{$controller}' AND name = '{$name}'", 1)) {
                $model->insert('perms_rules', array('controller' => $controller, 'name' => $name, 'type' => $type, 'options' => $options));
            }
        }
    }
}
開發者ID:Val-Git,項目名稱:icms2,代碼行數:11,代碼來源:install.php

示例2: savePermissions

 /**
  * Сохраняет значения правил для субъекта
  * @param string $subject Субъект действия правила
  * @param array $perms Правила и их значения
  */
 static function savePermissions($subject, $perms)
 {
     $model = new cmsModel();
     foreach ($perms as $rule_id => $values) {
         if (is_null($values)) {
             $model->filterEqual('subject', $subject)->filterEqual('rule_id', $rule_id)->deleteFiltered('perms_users');
             continue;
         }
         foreach ($values as $group_id => $value) {
             $model->filterEqual('subject', $subject)->filterEqual('rule_id', $rule_id)->filterEqual('group_id', $group_id)->lockFilters();
             if (!$value) {
                 $model->deleteFiltered('perms_users');
                 $model->unlockFilters();
                 $model->resetFilters();
                 continue;
             }
             $is_exists = $model->getFieldFiltered('perms_users', 'value');
             $model->unlockFilters();
             if ($is_exists) {
                 $model->updateFiltered('perms_users', array('rule_id' => $rule_id, 'group_id' => $group_id, 'subject' => $subject, 'value' => $value));
             } else {
                 $model->insert('perms_users', array('rule_id' => $rule_id, 'group_id' => $group_id, 'subject' => $subject, 'value' => $value));
             }
         }
         $model->resetFilters();
     }
 }
開發者ID:Val-Git,項目名稱:icms2,代碼行數:32,代碼來源:permissions.php

示例3: widgetInstall

 private function widgetInstall($manifest)
 {
     $model = new cmsModel();
     $model->insert('widgets', array('title' => $manifest['info']['title'], 'name' => $manifest['package']['name'], 'controller' => $manifest['package']['controller'], 'author' => isset($manifest['author']['name']) ? $manifest['author']['name'] : LANG_CP_PACKAGE_NONAME, 'url' => isset($manifest['author']['url']) ? $manifest['author']['url'] : null, 'version' => $manifest['version']['major'] . '.' . $manifest['version']['minor'] . '.' . $manifest['version']['build']));
     return 'widgets';
 }
開發者ID:Val-Git,項目名稱:icms2,代碼行數:6,代碼來源:install_finish.php


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