• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DB_DataObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 function __construct($cmid = 0)
 {
     global $db;
     $this->_cmid = $cmid;
     if ($this->_cmid != 0) {
         $this->_dbo = DB_DataObject::Factory("phph_comments");
         if (PEAR::isError($this->_dbo)) {
             throw new Exception2("Bd wewn�rzny", $this->_dbo->getMessage());
         }
         $r = $this->_dbo->get($cmid);
         if (PEAR::isError($r)) {
             throw new Exception2("Bd wewn�rzny", $r->getMessage());
         }
         if ($r == 0) {
             throw new Exception2("Bd", "Komentarz nie istnieje", COMMENT_NOT_FOUND);
         }
         $this->_user = DB_DataObject::Factory("phph_users");
         if (PEAR::isError($this->_user)) {
             throw new Exception2("Bd wewn�rzny", $this->_user->getMessage());
         }
         $r = $this->_user->get($this->_dbo->user_id);
         if (PEAR::isError($r)) {
             throw new Exception2("Bd wewn�rzny", $r->getMessage());
         }
         if ($r == 0) {
             throw new Exception2("Bd sp�noci danych", "Uytkownik do kt�ego nalezy komentarz nie istnieje.<br />Skontakuj si�z administratorem, podajc numer komentarza ({$cmid}).", COMMENT_USER_NOT_FOUND);
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:phphoto-svn,代码行数:29,代码来源:Comment.php


示例2: _newImage

 protected function _newImage(DB_DataObject $obj)
 {
     $defs = $obj->_getPluginsDef();
     $tbl = DB_DataObject::factory($defs['otfimagereceiver']['table']);
     $tbl->record_table = $obj->tableName();
     $tbl->record_id = $obj->pk();
     return $tbl;
 }
开发者ID:demental,项目名称:m,代码行数:8,代码来源:db.php


示例3: __construct

 public function __construct(DB_DataObject $do, $values)
 {
     $this->do = $do;
     if (!is_array($values)) {
         throw new Exception('Values must be an array !');
     }
     $this->values = $values;
     $this->db = $do->getDatabaseConnection();
 }
开发者ID:demental,项目名称:m,代码行数:9,代码来源:Search.php


示例4: getSessionFilterSubTable

 /**
  * @param DB_DataObject $class
  * @param string $label
  * @param string $field
  * @return array
  */
 function getSessionFilterSubTable($class, $label, $field)
 {
     $class->orderBy('value ASC');
     $class->find();
     $filter = array();
     $filter['label'] = $label;
     $filter['field'] = $field;
     $filter['values'] = array();
     $filter['values']['null'] = 'unset';
     while ($class->fetch()) {
         $filter['values'][$class->id] = $class->value;
     }
     natcasesort($filter['values']);
     return $filter;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:21,代码来源:AnalyticsReport.php


示例5: del

 function del($params)
 {
     $json = new Services_JSON();
     $subcategory = DB_DataObject::factory("subcategory");
     $subcategory->id = $params["id"];
     print $subcategory->delete() ? $json->encode(array("error" => false)) : $json->encode(array("error" => true));
 }
开发者ID:rivetweb,项目名称:old-python-generators,代码行数:7,代码来源:subcategories_controller.php


示例6: getq

 function getq($params)
 {
     $json = new Services_JSON();
     $item = DB_DataObject::factory("item");
     if (isset($params["categ"]) && $params["categ"] > 0) {
         $item->whereAdd("subcategory_id = {$params['categ']}", "OR");
         $item->whereAdd("subcategory_id2 = {$params['categ']}", "OR");
         $item->whereAdd("subcategory_id3 = {$params['categ']}", "OR");
     }
     $count = $item->count();
     $total = $count > 0 ? ceil($count / (int) $params["rows"]) : 0;
     $page = min($params["page"], $total);
     $start = max(0, (int) $params["rows"] * $page - (int) $params["rows"]);
     $item->selectAdd();
     $item->selectAdd("id, url, title, descr");
     $item->orderBy("{$params['sidx']} {$params['sord']}");
     $item->limit($start, (int) $params["rows"]);
     $item->find();
     $res = array();
     while ($item->fetch()) {
         $res["rows"][] = array("id" => $item->id, "cell" => array($item->id, $item->url, $item->title, $item->descr));
     }
     $res["page"] = $page;
     $res["total"] = $total;
     $res["records"] = $count;
     print $json->encode($res);
 }
开发者ID:rivetweb,项目名称:old-python-generators,代码行数:27,代码来源:items_controller.php


示例7: init

 function init($pg)
 {
     $group = DB_DataObject::factory('core_group');
     // group should be auto created - by update-database...
     if (!$group->get('name', 'core-person-signup-bcc')) {
         $group = DB_DataObject::factory('core_group');
         $group->name = 'core-person-signup-bcc';
         $group->insert();
     }
     $p = DB_DataObject::factory('core_person');
     if (!$p->count()) {
         return;
         // can not check people...
     }
     // got people...
     $member = DB_DataObject::factory('core_group_member');
     $member->group_id = $group->id;
     if ($member->count()) {
         return;
     }
     // not got members..
     // if we only have one member - then add it .... (it's the admin, and they can modify this later.. - after they get annoyed with it..
     $p->find(true);
     $member = DB_DataObject::factory('core_group_member');
     $member->group_id = $group->id;
     $member->user_id = $p->id;
     $member->insert();
     // only display if we have members..
 }
开发者ID:roojs,项目名称:Pman.Core,代码行数:29,代码来源:Pman.php


示例8: launchFacebook

function launchFacebook($terminoBuscar)
{
    $app_access_token = genToken();
    $resultFacebook = app_request("https://graph.facebook.com/v2.5/search?q=" . $terminoBuscar . "&type=page&limit=10&fields=id,name,picture.type(normal),likes&" . $app_access_token);
    //printVar($resultFacebook,$_SERVER['SERVER_NAME'].'/publication/search/results/resultFacebook.json');
    //printVar($_SERVER["DOCUMENT_ROOT"]);
    $fp = fopen($_SERVER["DOCUMENT_ROOT"] . '/publication/search/results/resultFacebook.json', 'w');
    $qpaso = fwrite($fp, json_encode($resultFacebook));
    fclose($fp);
    //printVar($qpaso,'que paso');
    $obj = DB_DataObject::Factory('MpBrand');
    $obj->name = $terminoBuscar;
    $find = $obj->find();
    if ($find > 0) {
        // echo 'entra al if';
        while ($obj->fetch()) {
            //DB_DataObject::debugLevel(1);
            $obj->picture = $resultFacebook['data'][0]['picture']['data']['url'];
            $obj->update();
        }
    } else {
    }
    $obj->free();
    //echo json_encode('');
}
开发者ID:brm-sanabrias,项目名称:nemo,代码行数:25,代码来源:launcher.php


示例9: execute

 function execute(&$controller, &$request, &$user)
 {
     $account = $request->getParameter('account');
     $format = $request->hasParameter('format') ? $request->getParameter('format') : 'html';
     $member = DB_DataObject::factory('member');
     $member->get('account', $account);
     $site = DB_DataObject::factory('site');
     $site->get('member_id', $member->id);
     $feed = DB_DataObject::factory('feed');
     $feeds = $feed->getListsByAccount($account);
     switch ($format) {
         case 'opml11':
             foreach ($feeds as $key => $feed) {
                 $f = array('title' => $feed->title, 'text' => $feed->description, 'link' => $feed->link, 'uri' => $feed->uri);
                 $feeds[$key] = $f;
             }
             $writer =& new OPMLWriter();
             $writer->setHead(array('title' => $site->title, 'date' => time(), 'owner' => $account));
             $writer->setOutlines($feeds);
             $writer->display($format);
             return VIEW_NONE;
         case 'html':
         default:
             $request->setAttribute('sources', $feeds);
             return VIEW_SUCCESS;
     }
 }
开发者ID:komagata,项目名称:plnet,代码行数:27,代码来源:SourcesAction.class.php


示例10: recover

 function recover($code)
 {
     if (!$this->getAuthUser()) {
         $this->jerr("invalid");
     }
     // fixme!!!!
     $fn = $this->rootDir . '/Pman/' . $code . '.js';
     list($app, $mod) = explode('/', $code);
     if (!file_exists($fn)) {
         $this->jerr("file does not exist.:" . $fn);
     }
     $data = file_get_contents($fn);
     preg_match("#/*\n--SOURCE--\n([^\\*]+)#m", $data, $matches);
     // echo "<PRE>";print_R($matches);
     $base = $matches[1];
     $str = bzdecompress(base64_decode($base));
     $js = json_decode($str);
     //echo "<PRE>";print_R($str);
     $b = DB_DataObject::factory('builder');
     $b->app = $app;
     $b->module = $mod;
     $b->btype = 'FORM';
     $b->name = $js->name;
     if (!$b->find(true)) {
         $b->insert();
     }
     echo "<PRE>" . htmlspecialchars(print_r($b, true));
     $b->json = $str;
     $b->update();
     $this->jok("DONE");
     exit;
 }
开发者ID:roojs,项目名称:Pman.Builder,代码行数:32,代码来源:Code.php


示例11: login

 function login()
 {
     $this->showStylesheets();
     $nickname = common_canonical_nickname($this->trimmed('nickname'));
     $password = $this->arg('password');
     $msg = null;
     if ($nickname) {
         if (common_check_user($nickname, $password)) {
             $user = User::staticGet('nickname', $nickname);
             if (!$user) {
                 $this->showLoginForm(_m("Server error: Couldn't get user!"));
             }
             $flink = DB_DataObject::factory('foreign_link');
             $flink->user_id = $user->id;
             $flink->foreign_id = $this->fbuid;
             $flink->service = FACEBOOK_SERVICE;
             $flink->created = common_sql_now();
             $flink->set_flags(true, false, false, false);
             $flink_id = $flink->insert();
             // XXX: Do some error handling here
             $this->setDefaults();
             $this->getUpdatePermission();
             return;
         } else {
             $msg = _m('Incorrect username or password.');
         }
     }
     $this->showLoginForm($msg);
     $this->showFooter();
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:30,代码来源:facebookhome.php


示例12: listGroupMembership

 /**
  * Get a list of memberships for a person
  * @param Pman_Core_DataObjects_Person $person who
  * @param String column to fetch.. eg. group_id or 'name'
  *
  */
 function listGroupMembership($person, $arrayof = 'group_id')
 {
     $this->inAdmin = false;
     $t = clone $this;
     //DB_DataObject::debugLevel(1);
     $grp = DB_DataObject::factory('core_group');
     $t->joinAdd($grp, 'LEFT');
     //$person->id = (int)$person->id;
     $t->whereAdd("\n            user_id = {$person->id}\n        ");
     $t->selectAdd();
     $t->selectAdd("distinct(group_id), {$grp->tableName()}.name as name");
     $t->whereAdd('group_id IS NOT NULL');
     $t->find();
     $ret = array();
     // $ret = $arrayof == 'group_id' ? array(0) : array();
     // default member of 'All groups'!!
     while ($t->fetch()) {
         $ret[] = $t->{$arrayof};
         if ($t->name == 'Administrators') {
             /// mmh... bit risky?
             $this->inAdmin = true;
         }
     }
     if ($arrayof == 'group_id' && !count($ret)) {
         $ret = array(0);
         /// default if they are not a member of any group.
     }
     //var_dump($ret);
     return $ret;
 }
开发者ID:roojs,项目名称:Pman.Core,代码行数:36,代码来源:Core_group_member.php


示例13: lunchReport

 public function lunchReport($idBrand, $idSocialNetwork, $idInteraction)
 {
     $report = DB_DataObject::Factory('MpBrandXSocialNetwork');
     // DB_DataObject::debugLevel(1);
     $report->idBrand = $idBrand;
     $report->idInteraction = $idInteraction;
     $report->idSocialNetwork = $idSocialNetwork;
     $find = $report->find();
     if ($find > 0) {
         while ($report->fetch()) {
             if ($report->status == 'L') {
                 $report->status = 'E';
                 $report->update();
             }
         }
     } else {
         $report->snID = "Aqui va algo";
         $report->ownedBrand = 'N';
         $report->status = 'E';
         $report->date = date('Y-m-d h:i:s');
         $l = $report->insert();
         // printVar($l);
     }
     $report->free();
     return 'ok';
 }
开发者ID:brm-sanabrias,项目名称:nemo,代码行数:26,代码来源:class.Util.MrPlow.inc.php


示例14: get

 function get($table)
 {
     $d = DB_DAtaObject::Factory($table);
     if (method_exists($d, 'availableColumns')) {
         $cols = $d->availableColumns();
     } else {
         $re = $d->autoJoin();
         //echo '<PRE>';print_r($re);
         $cols = $re['cols'];
         $types = array();
         $tables = array();
         $schemas = array($table => $d->table());
         foreach ($cols as $name => $table_col) {
             list($tbl, $col) = explode('.', $table_col);
             if (!isset($schemas[$tbl])) {
                 $schemas[$tbl] = DB_DataObject::Factory($tbl)->table();
             }
             $types[$name] = $schemas[$tbl][$col];
             $tables[$name] = $tbl;
         }
         foreach ($re['join_names'] as $c => $f) {
             $cols[$c] = $f;
         }
     }
     foreach ($cols as $c => $f) {
         $ret[] = array('name' => $c, 'val' => $f, 'type' => isset($types[$c]) ? $this->typeToName($types[$c]) : -1, 'table' => isset($tables[$c]) ? $tables[$c] : "");
     }
     $this->jdata($ret);
 }
开发者ID:roojs,项目名称:Pman.Core,代码行数:29,代码来源:DatabaseColumns.php


示例15: post

 function post()
 {
     $si = DB_DataObject::factory('Signup');
     if (empty($_REQUEST['id']) || !$si->get($_REQUEST['id'])) {
         $this->jerr("invalid request");
     }
     if ($si->person_id != 0) {
         $si->jerr("Account already processed");
     }
     // rejected..
     if ($_REQUEST['person_id'] < 0) {
         $si->setFrom($_REQUEST);
         $si->update();
         $this->jok("OK");
     }
     $p = DB_DataObject::factory("core_person");
     $p->setFrom($_REQUEST);
     $p->insert();
     $si->setFrom($_REQUEST);
     $si->person_id = $p->id;
     $si->update();
     // generate a password
     // and send welcome message.
     $this->jok($p->toArray());
 }
开发者ID:roojs,项目名称:Pman.Admin,代码行数:25,代码来源:Signup.php


示例16: delete

 public function delete()
 {
     $log = DB_DataObject::factory('log');
     $log->id_users = $this->id;
     $this->user_log(e('log_cleanup', array($log->delete())));
     redirect('log');
 }
开发者ID:emanuelwiesner,项目名称:arcanum,代码行数:7,代码来源:log.php


示例17: makeEditForm

function makeEditForm($selfurl)
{
    // nice names for each field
    $formNames = array('cfg_incoming_path' => 'Kannel Incoming Path: ', 'cfg_username' => 'Username:', 'cfg_password' => 'Password:', 'cfg_global_sender' => 'Global Sender:', 'cfg_bearerbox_host' => 'Bearerbox IP:', 'cfg_sendsms_port' => 'Send SMS Port:', 'cfg_playsms_web' => 'PlaySMS web url:', 'cfg_restart_frequency' => 'Restart Kannel Regularly?');
    // infer the fields we're going to show
    // from the list of formNames
    $renderFields = array();
    foreach ($formNames as $field => $name) {
        $renderFields[] = $field;
    }
    // find the first record in the config table
    $do = DB_DataObject::factory('playsms_gwmodKannel_config');
    $do->get(1);
    // create the form with the user-showable names
    $fb = DB_DataObject_FormBuilder::create($do, array("fieldLabels" => $formNames, "fieldsToRender" => $renderFields));
    // set up enums
    $fb->enumFields = array('cfg_restart_frequency');
    $form = $fb->getForm("{$selfurl}");
    if ($form->validate()) {
        $err = "Gateway module configurations has been saved";
        print "<p><font color=red>{$err}</font><p>";
        $form->process(array(&$fb, 'processForm'), false);
    }
    $form->display();
    echo "<p/><hr/><p/>";
    echo "<a href=\"plugin/gateway/kannel/kannel-monitor/\">[ Monitor Status ]</a> \n";
    echo "<a href=\"{$selfurl}&op=manage_smsc\">[ Bind SMSC ]</a>";
}
开发者ID:laiello,项目名称:ya-playsms,代码行数:28,代码来源:manage.php


示例18: _getCache

 function _getCache($uri)
 {
     $feed = DB_DataObject::factory('feed');
     $feed->uri = $uri;
     $feed->find();
     $feed->fetch();
     $channel = array('title' => $feed->title, 'link' => $feed->link, 'favicon' => $feed->favicon);
     // items
     $items = array();
     $f2e = DB_DataObject::factory('feed_to_entry');
     $f2e->feed_id = $feed->id;
     $f2e->find();
     while ($f2e->fetch()) {
         $entry = DB_DataObject::factory('entry');
         $entry->id = $f2e->entry_id;
         $entry->find();
         while ($entry->fetch()) {
             $item = array();
             $item['title'] = $entry->title;
             $item['link'] = $entry->uri;
             $item['description'] = $entry->description;
             $item['date'] = $entry->date;
             $items[] = $item;
         }
     }
     $struct = array('channel' => $channel, 'items' => $items);
     return $struct;
 }
开发者ID:komagata,项目名称:plnet,代码行数:28,代码来源:CachedFeed.php


示例19: hasReleases

 function hasReleases()
 {
     $rel =& DB_DataObject::factory('releases');
     $rel->channel = $this->channel;
     $rel->package = $this->package;
     return $rel->find();
 }
开发者ID:stof,项目名称:pearweb,代码行数:7,代码来源:Packages.php


示例20: populateCMS

 protected function populateCMS($action)
 {
     try {
         $content = Mreg::get('content');
     } catch (Exception $e) {
         $content = DB_DataObject::factory($this->_dbtable);
     }
     if (!$this->_forceaccessible && !empty($this->_dbaccessibleaspage)) {
         $content->{$this->_dbaccessibleaspage} = 1;
     }
     if (key_exists('alias_id', $content->table())) {
         $content->whereAdd('alias_id is null');
     }
     if (!$content->get($this->_dbstrip, $action)) {
         $this->handleNotFound($action);
         return;
     }
     if ($content->{$this->_dbisnode}) {
         $target = strtolower(str_replace('Module_', '', get_class($this))) . '/' . $content->getPlugin('tree')->getFirstChild($content)->{$this->_dbstrip};
         $this->redirect301($target);
     }
     $this->assignRef('content', $content);
     $this->_content = $content;
     try {
         Mreg::set('content', $content);
     } catch (Exception $e) {
     }
     $this->assign($this->_tpltitle, $content->{$this->_dbtitle});
 }
开发者ID:demental,项目名称:m,代码行数:29,代码来源:CMS.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DB_Functions类代码示例发布时间:2022-05-23
下一篇:
PHP DB_CONNECT类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap