id = (int) $this->id; return true; } /** * メンバー変数に格納された値を登録する * @return boolean True if success stored,false otherwise */ function store() { if (!$this->check()) { return false; } global $my; $userid = (int) $my->id; $now = time(); if (!$this->id) { /* * 新規登録 */ $this->created = $now; $this->created_by = $userid; } $this->modified = $now; $this->modified_by = $userid; $result = parent::store(); if (!$result) { trigger_error("Failed store: ".$this->getError(), E_USER_WARNING); return false; } if (!$this->id) { /* * 新規登録のID取得 */ $this->id = (int) $this->_db->insertid(); } return true; } /** * ID を取得 * @return int id */ function id() { return (int) $this->id; } /** * 登録日時を取得 * @return int created timestamp */ function created() { return (int) $this->created; } /** * 登録ユーザを取得 * @return mosUser created user */ function created_by() { $id = (int) $this->created_by; if (!$id) return null; $user = new mosUser($this->_db); $result = $user->load($id); if (!$result) { trigger_error( "Failed load created user: ".$user->getError() , E_USER_WARNING ); return null; } return $user; } /** * 更新日時を取得 * @return int modified timestamp */ function modified() { return (int) $this->modified; } /** * 更新ユーザを取得 * @return mosUser modified user */ function modified_by() { $id = (int) $this->modified_by; if (!$id) return null; $user = new mosUser($this->_db); $result = $user->load($id); if (!$result) { trigger_error( "Failed load modified user: ".$user->getError() , E_USER_WARNING ); return null; } return $user; } }