示例#1
0
文件: Comment.php 项目: Roave/issues
 protected function _insert(Default_Model_Comment $comment)
 {
     $data = array('created_time' => new Zend_Db_Expr('NOW()'), 'created_by' => $comment->getCreatedBy()->getUserId(), 'issue' => $comment->getIssue()->getIssueId(), 'text' => $comment->getText(false), 'private' => $comment->isPrivate() ? 1 : 0, 'system' => $comment->isSystem() ? 1 : 0);
     $db = $this->getWriteAdapter();
     $db->insert($this->getTableName(), $data);
     return $db->lastInsertId();
 }
示例#2
0
文件: Edit.php 项目: Roave/issues
 public function setDefaultValues(Default_Model_Comment $comment)
 {
     $this->getElement('text')->setValue($comment->getText(false));
     $this->getSubform('permissions')->getElement('private')->setChecked($comment->isPrivate());
     $roles = Zend_Registry::get('Default_DiContainer')->getAclService()->getRolesForResource('comment', $comment->getCommentId());
     $roleIds = array();
     foreach ($roles as $role) {
         $roleIds[] = $role->getRoleId();
     }
     $this->getSubform('permissions')->getElement('roles')->setValue($roleIds);
 }