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


PHP Datamodel::getTableInstance方法代碼示例

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


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

示例1: saveComment

 function saveComment()
 {
     if (!$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'loginForm'));
         return;
     }
     $o_datamodel = new Datamodel();
     if (!($t_set = $this->_getSet(__CA_SET_READ_ACCESS__))) {
         $this->Index();
         return;
     }
     $ps_tablename = $this->request->getParameter('tablename', pString);
     if (!$ps_tablename) {
         $this->Index();
         return;
     }
     # --- check this is a valid table to have comments in the lightbox
     if (!in_array($ps_tablename, array("ca_sets", "ca_set_items"))) {
         $this->Index();
     }
     # --- load table
     $t_item = $o_datamodel->getTableInstance($ps_tablename);
     $pn_item_id = $this->request->getParameter('item_id', pInteger);
     $t_item->load($pn_item_id);
     $ps_comment = $this->request->getParameter('comment', pString);
     if (!$ps_comment) {
         $this->notification->addNotification(_t("Please enter a comment"), __NOTIFICATION_TYPE_ERROR__);
     } else {
         # --- pass user's id as moderator - all set comments should be made public, it's a private space and comments should not need to be moderated
         if ($t_item->addComment($ps_comment, null, $this->request->getUserID(), null, null, null, 1, $this->request->getUserID(), array("purify" => true))) {
             $this->notification->addNotification(_t("Saved comment"), __NOTIFICATION_TYPE_INFO__);
         } else {
             $this->notification->addNotification(_t("There were errors saving your comment"), __NOTIFICATION_TYPE_ERROR__);
         }
     }
     if ($ps_tablename == "ca_sets") {
         $this->setDetail();
     }
 }
開發者ID:ffarago,項目名稱:pawtucket2,代碼行數:39,代碼來源:SetsController.php


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