- Timestamp:
- 07/08/08 23:40:10 (5 years ago)
- Location:
- events/phpframework/rhaco/trunk
- Files:
-
- 1 removed
- 17 modified
-
__init__.php (modified) (1 diff)
-
index.php (modified) (1 diff)
-
library/Phwittr.php (modified) (2 diffs)
-
library/PhwittrStatus.php (modified) (4 diffs)
-
library/PhwittrUser.php (modified) (8 diffs)
-
library/model/Follow.php (modified) (1 diff)
-
library/model/LoginCondition.php (deleted)
-
library/model/User.php (modified) (3 diffs)
-
library/model/table/FollowTable.php (modified) (6 diffs)
-
library/model/table/FollowingTable.php (modified) (2 diffs)
-
library/model/table/ReplytoTable.php (modified) (2 diffs)
-
library/model/table/StandByTable.php (modified) (6 diffs)
-
library/model/table/StatusTable.php (modified) (8 diffs)
-
library/model/table/TmpRegistrationTable.php (modified) (8 diffs)
-
library/model/table/UserTable.php (modified) (16 diffs)
-
resources/templates/default/js/application.js (modified) (2 diffs)
-
resources/templates/default/layout.html (modified) (1 diff)
-
setup/project.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
events/phpframework/rhaco/trunk/__init__.php
r13849 r15508 9 9 10 10 require_once '__settings__.php'; 11 Rhaco::import('model.LoginCondition'); 11 Rhaco::import('network.http.model.RequestLoginConditionDb'); 12 Rhaco::import('database.DbUtil'); 12 13 Rhaco::import('model.User'); 13 14 -
events/phpframework/rhaco/trunk/index.php
r14540 r15508 118 118 $db 119 119 ); 120 $request = new Request(); 121 if($request->isSession('notice')){ 122 $parser->setVariable('notice', $request->getSession('notice')); 123 $request->clearSession('notice'); 124 } 120 125 if(RequestLogin::isLogin()){ 121 126 $parser->setVariable('isLogin', true); -
events/phpframework/rhaco/trunk/library/Phwittr.php
r14540 r15508 15 15 Rhaco::import('model.Follow'); 16 16 Rhaco::import('model.Status'); 17 Rhaco::import('model.StandBy'); 17 18 18 19 /** … … 205 206 206 207 function loginRequired(){ 207 RequestLogin::loginRequired(new LoginCondition($this->dbUtil)); 208 return RequestLogin::getLoginSession(); 208 if(RequestLogin::silent(new RequestLoginConditionDb($this->dbUtil, new User()))){ 209 return RequestLogin::getLoginSession(); 210 } 211 Header::redirect(Rhaco::url('login')); 212 Rhaco::end(); 209 213 } 210 214 } -
events/phpframework/rhaco/trunk/library/PhwittrStatus.php
r14550 r15508 15 15 $status = $this->dbUtil->get(new Status($statusId), new C(Q::fact())); 16 16 if(Variable::istype('TableObjectBase', $status)){ 17 $user = $status->factUserId; 17 18 if($status->factUserId->hasPermission($this->dbUtil, RequestLogin::getLoginSession())){ 18 $user = $status->factUserId;19 19 $parser = new HtmlParser(Rhaco::constant('THEME'). '/status_detail.html'); 20 20 $parser->setVariable('object', $status); … … 44 44 if(Variable::istype('TableObjectBase', $status)){ 45 45 // success 46 $status->user = sprintf('<a href="%s"><img src="%s" width="48" height="48" alt="%s"/></a> <a href="%s">%s</a>', Rhaco::url($user->getName()), Rhaco::url('picture/thumbnail/'.$user->getImage()), $user->getName(), Rhaco::url($user->getName()), $user->getName());47 46 $replyUserName = $status->getReplyUserName(); 48 47 $status->comment = PhwittrFormatter::c($status->comment); … … 53 52 'message' => 'status updated!', 54 53 'status' => $status, 54 'user' => $user, 55 55 ); 56 56 } else { … … 68 68 break; 69 69 default: 70 if(Variable::istype('TableObjectBase', $status)) 71 $this->setSession('notice', 'status updated!'); 70 72 Header::redirect(Rhaco::url('home')); 71 73 } -
events/phpframework/rhaco/trunk/library/PhwittrUser.php
r14912 r15508 17 17 Header::redirect(Rhaco::url('home')); 18 18 } 19 $parser = $this->confirmedCreate( Rhaco::url(), new TmpRegistration());19 $parser = $this->confirmedCreate(new TmpRegistration(), Rhaco::url()); 20 20 if($this->isPost()){ 21 21 $parser->setTemplate(Rhaco::constant('THEME') . '/account/create_confirm.html'); … … 58 58 $user = $this->loginRequired(); 59 59 $this->clearVariable('id', 'password', 'createdAt', 'updatedAt', 'deleteFlag', 'statusCount', 'followingCount', 'followerCount'); 60 $user = $this->dbUtil->get(new User($user->getId()));61 60 $this->setVariable('privateFlag', ($this->isVariable('privateFlag')) ? 1 : 0); 62 $parser = $this->update( Rhaco::url('account/settings'), $this->toObject($user));61 $parser = $this->update(new User(), new C(Q::eq(User::columnId(), $user->getId())), Rhaco::url('account/settings')); 63 62 $parser->setTemplate(Rhaco::constant('THEME') . '/account/settings.html'); 64 63 $parser->setVariable('user', $user); … … 96 95 } catch(PicturizeException $e){ 97 96 L::warning($e->getMessage()); 97 $this->setSession('notice', $e->getMessage()); 98 98 Header::redirect(Rhaco::url('account/picture')); 99 99 } … … 101 101 $user->setImage($user->getId() . $file->getExtension()); 102 102 if($user->save($this->dbUtil)){ 103 $this->setSession('notice', 'Nice Picture!'); 103 104 Header::redirect(Rhaco::url('account/picture')); 104 105 } … … 121 122 $user->setImage(''); 122 123 $user->save($this->dbUtil); 124 $this->setSession('notice', 'Picture deleted.'); 123 125 Header::redirect(Rhaco::url('account/picture')); 124 126 } … … 126 128 function follow($followId){ 127 129 $user = $this->loginRequired(); 128 $response = array('error' => 1, 'message' => ' unknown error');130 $response = array('error' => 1, 'message' => 'POST してくれ。'); 129 131 if($this->isPost()){ 130 $followUser = $this->dbUtil->get(new User($followId)); 131 if(Variable::istype('TableObjectBase', $followUser)){ 132 $follow = $this->dbUtil->get(new Follow(), new C(Q::eq(Follow::columnUserId(), $user->getId()), Q::eq(Follow::columnFollowId(), $followUser->getId()))); 133 if(Variable::istype('TableObjectBase', $follow)){ 134 $response = array('error' => 1, 'message' => 'you already following '. $followUser->getName()); 135 } else { 136 $followed = $this->dbUtil->get(new Follow(), new C(Q::eq(Follow::columnUserId(), $followUser->id), Q::eq(Follow::columnFollowId(), $user->id))); 137 // 登録処理 138 if($followUser->privateFlag && !Variable::istype('TableObjectBase', $followed)){ 139 $request = new StandBy(); 140 $request->setUserId($user->id); 141 $request->setRequestId($followUser->id); 142 if($request->save($this->dbUtil)){ 143 $response = array('error' => 0, 'message' => 'You requested a follow from '. $followUser->name. '.'); 144 } 145 } else { 146 $follow = new Follow(); 147 $follow->setUserId($user->getId()); 148 $follow->setFollowId($followUser->getId()); 149 if($follow->save($this->dbUtil)){ 150 $response = array('error' => 0, 'message' => 'You are now following '.$followUser->getName().'.'); 151 } 152 } 153 } 132 $follow = new Follow(); 133 $follow->setUserId($user->getId()); 134 $follow->setFollowId($followUser->getId()); 135 if($follow->save($this->dbUtil)){ 136 $response = array('error' => 0, 'message' => 'You are now following '.$followUser->getName().'.'); 137 } else { 138 // TODO: Exception 139 $response = array('error' => 1, 'message' => 'なんかしらんけど follow できんかった'); 154 140 } 155 } else {156 Rhaco::end();157 141 } 158 142 $response = V::toJson($response); … … 161 145 echo $response; 162 146 Rhaco::end(); 163 Header::redirect(Rhaco::url('home'));164 147 } 165 148 166 149 function disFollow($followId){ 167 150 $user = $this->loginRequired(); 168 $response = array('error' => 1, 'message' => ' unknown error');151 $response = array('error' => 1, 'message' => 'POST してくれ。'); 169 152 if($this->isPost()){ 170 153 $followUser = $this->dbUtil->get(new User($followId)); 171 154 $follow = $this->dbUtil->get(new Follow(), new C(Q::eq(Follow::columnUserId(), $user->getId()), Q::eq(Follow::columnFollowId(), $followId))); 172 155 if(Variable::istype('TableObjectBase', $follow)){ 173 if($user->privateFlag){174 $this->dbUtil->delete(new Follow(), new C(Q::eq(Follow::columnFollowId(), $user->getId()), Q::eq(Follow::columnUserId(), $followId)));175 $request = new StandBy();176 $request->setUserId($followUser->id);177 $request->setRequestId($user->id);178 $request->save($this->dbUtil);179 }180 156 if($this->dbUtil->delete($follow)){ 181 157 $response = array('error' => 0, 'message' => 'You are no longer following '.$followUser->getName().'.'); 158 } else { 159 $response = array('error' => 1, 'message' => '削除できなかったよ?なんで?'); 182 160 } 183 161 } 184 } else {185 Rhaco::end();186 162 } 187 163 $response = V::toJson($response); … … 190 166 echo $response; 191 167 Rhaco::end(); 192 Header::redirect(Rhaco::url('home'));193 168 } 194 169 195 170 function login(){ 196 171 RequestLogin::loginRequired(new LoginCondition($this->dbUtil)); 172 $user = RequestLogin::getLoginSession(); 173 $this->setSession('notice', 'Hi! ' . $user->name); 197 174 Header::redirect(Rhaco::url('home')); 198 175 } -
events/phpframework/rhaco/trunk/library/model/Follow.php
r14550 r15508 16 16 */ 17 17 class Follow extends FollowTable{ 18 function beforeInsert(&$db){ 19 // TODO: エラー時はexception投げましょう 20 $user = (Variable::istype('TableObjectBase', $this->factUserId)) ? $this->factUserId : $db->get(new User($this->userId)); 21 $followUser = $this->dbUtil->get(new User($this->followId)); 22 if(Variable::istype('TableObjectBase', $followUser)){ 23 $followed = $db->get(new Follow(), new C(Q::eq(Follow::columnUserId(), $followUser->id), Q::eq(Follow::columnFollowId(), $user->id))); 24 if($followUser->privateFlag && !Variable::istype('TableObjectBase', $followed)){ 25 $request = new StandBy(); 26 $request->setUserId($user->id); 27 $request->setRequestId($followUser->id); 28 if($request->save($this->dbUtil)){ 29 return true; 30 } 31 } 32 } else { 33 return false; 34 } 35 } 36 37 function beforeDelete(&$db){ 38 $user = (Variable::istype('TableObjectBase', $this->factUserId)) ? $this->factUserId : $db->get(new User($this->userId)); 39 if($user->privateFlag){ 40 $this->dbUtil->delete(new Follow(), new C(Q::eq(Follow::columnFollowId(), $this->userId), Q::eq(Follow::columnUserId(), $this->followId))); 41 $request = new StandBy(); 42 $request->setUserId($this->followId); 43 $request->setRequestId($this->userId); 44 $request->save($db); 45 } 46 } 47 18 48 function afterInsert(&$db){ 19 49 $this->recount($db, true); -
events/phpframework/rhaco/trunk/library/model/User.php
r14536 r15508 16 16 class User extends UserTable{ 17 17 function hasPermission(&$db, $user=null){ 18 if(!$this->privateFlag ){18 if(!$this->privateFlag || $this->id === $user->id){ 19 19 return true; 20 20 } … … 30 30 function beforeInsert($db){ 31 31 $this->password = sha1($this->password); 32 $this->hash = $this->_generateCookiekey($this->id, $this->name, $this->password); 33 } 34 function beforeUpdate($db){ 35 $this->hash = $this->_generateCookiekey($this->id, $this->name, $this->password); 32 36 } 33 37 function afterUpdate($db){ … … 39 43 return true; 40 44 } 45 46 function loginCondition(&$db, &$var, $request){ 47 if(!$request->isPost()){ 48 return false; 49 } 50 $login = $request->getVariable('login'); 51 if(strpos($login, '@') !== false){ 52 $criterion = Q::eq(User::columnEmail(), $login); 53 } else { 54 $criterion = Q::eq(User::columnName(), $login); 55 } 56 $user = $db->get( 57 new User(), 58 new C( 59 $criterion, 60 Q::eq(User::columnPassword(), sha1($request->getVariable('password'))) 61 ) 62 ); 63 if(Variable::istype('TableObjectBase', $user)){ 64 $var = $user; 65 RequestLogin::setLoginCookie($this->_generateCookiekey($user->id, $user->name, $user->password)); 66 return true; 67 } 68 return false; 69 } 70 function loginConditionCookie(&$db, &$var, $cookiekey){ 71 $user = $db->get(new User(), new C(Q::eq(User::columnHash(), $cookiekey))); 72 if(Variable::istype('TableObjectBase', $user)){ 73 $var = $user; 74 return true; 75 } 76 return false; 77 } 78 function _generateCookiekey(){ 79 return sha1(implode(Rhaco::constant('CONTEXT_URL'), func_get_args())); 80 } 41 81 } 42 82 -
events/phpframework/rhaco/trunk/library/model/table/FollowTable.php
r14912 r15508 3 3 Rhaco::import("database.model.TableObjectBase"); 4 4 Rhaco::import("database.model.DbConnection"); 5 Rhaco::import("database.TableObjectUtil"); 6 Rhaco::import("database.model.Table"); 7 Rhaco::import("database.model.Column"); 5 8 /** 6 9 * #ignore … … 30 33 } 31 34 function connection(){ 32 return new DbConnection("phwittr"); 35 if(!Rhaco::isVariable("_R_D_CON_","phwittr")){ 36 Rhaco::addVariable("_R_D_CON_",new DbConnection("phwittr"),"phwittr"); 37 } 38 return Rhaco::getVariable("_R_D_CON_",null,"phwittr"); 33 39 } 34 40 function table(){ 35 return new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."follow",__CLASS__); 41 if(!Rhaco::isVariable("_R_D_T_","Follow")){ 42 Rhaco::addVariable("_R_D_T_",new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."follow",__CLASS__),"Follow"); 43 } 44 return Rhaco::getVariable("_R_D_T_",null,"Follow"); 36 45 } 37 46 /** … … 40 49 */ 41 50 function columnId(){ 42 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 43 $column->label(Message::_("id")); 44 return $column; 51 if(!Rhaco::isVariable("_R_D_C_","Follow::Id")){ 52 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 53 $column->label(Message::_("id")); 54 Rhaco::addVariable("_R_D_C_",$column,"Follow::Id"); 55 } 56 return Rhaco::getVariable("_R_D_C_",null,"Follow::Id"); 45 57 } 46 /** */ 58 /** 59 * 60 * @return serial */ 47 61 function setId($value){ 48 62 $this->id = TableObjectUtil::cast($value,"serial"); 49 63 } 50 /** */ 64 /** 65 * 66 */ 51 67 function getId(){ 52 68 return $this->id; … … 57 73 */ 58 74 function columnUserId(){ 59 $column = new Column("column=user_id,variable=userId,type=integer,size=22,unique=true,reference=User::Id,uniqueWith=Follow::FollowId,"); 60 $column->label(Message::_("user_id")); 61 return $column; 75 if(!Rhaco::isVariable("_R_D_C_","Follow::UserId")){ 76 $column = new Column("column=user_id,variable=userId,type=integer,size=22,unique=true,reference=User::Id,uniqueWith=Follow::FollowId,"); 77 $column->label(Message::_("user_id")); 78 Rhaco::addVariable("_R_D_C_",$column,"Follow::UserId"); 79 } 80 return Rhaco::getVariable("_R_D_C_",null,"Follow::UserId"); 62 81 } 63 /** */ 82 /** 83 * 84 * @return integer */ 64 85 function setUserId($value){ 65 86 $this->userId = TableObjectUtil::cast($value,"integer"); 66 87 } 67 /** */ 88 /** 89 * 90 */ 68 91 function getUserId(){ 69 92 return $this->userId; … … 74 97 */ 75 98 function columnFollowId(){ 76 $column = new Column("column=follow_id,variable=followId,type=integer,size=22,require=true,unique=true,uniqueWith=Follow::UserId,"); 77 $column->label(Message::_("follow_id")); 78 return $column; 99 if(!Rhaco::isVariable("_R_D_C_","Follow::FollowId")){ 100 $column = new Column("column=follow_id,variable=followId,type=integer,size=22,require=true,unique=true,uniqueWith=Follow::UserId,"); 101 $column->label(Message::_("follow_id")); 102 Rhaco::addVariable("_R_D_C_",$column,"Follow::FollowId"); 103 } 104 return Rhaco::getVariable("_R_D_C_",null,"Follow::FollowId"); 79 105 } 80 /** */ 106 /** 107 * 108 * @return integer */ 81 109 function setFollowId($value){ 82 110 $this->followId = TableObjectUtil::cast($value,"integer"); 83 111 } 84 /** */ 112 /** 113 * 114 */ 85 115 function getFollowId(){ 86 116 return $this->followId; … … 91 121 */ 92 122 function columnCreatedAt(){ 93 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 94 $column->label(Message::_("created_at")); 95 return $column; 123 if(!Rhaco::isVariable("_R_D_C_","Follow::CreatedAt")){ 124 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 125 $column->label(Message::_("created_at")); 126 Rhaco::addVariable("_R_D_C_",$column,"Follow::CreatedAt"); 127 } 128 return Rhaco::getVariable("_R_D_C_",null,"Follow::CreatedAt"); 96 129 } 97 /** */ 130 /** 131 * 132 * @return timestamp */ 98 133 function setCreatedAt($value){ 99 134 $this->createdAt = TableObjectUtil::cast($value,"timestamp"); 100 135 } 101 /** */ 136 /** 137 * 138 */ 102 139 function getCreatedAt(){ 103 140 return $this->createdAt; -
events/phpframework/rhaco/trunk/library/model/table/FollowingTable.php
r14912 r15508 4 4 Rhaco::import("database.model.DbConnection"); 5 5 Rhaco::import("model.User"); 6 Rhaco::import("database.TableObjectUtil"); 7 Rhaco::import("database.model.Table"); 8 Rhaco::import("database.model.Column"); 6 9 /** 7 10 * #ignore … … 13 16 14 17 function table(){ 15 return new Table(parent::table(),__CLASS__); 18 if(!Rhaco::isVariable("_R_D_T_","Following")){ 19 Rhaco::addVariable("_R_D_T_",new Table(parent::table(),__CLASS__),"Following"); 20 } 21 return Rhaco::getVariable("_R_D_T_",null,"Following"); 16 22 } 17 23 function columns(){ 18 return array(Following::columnId(),Following::columnName(),Following::columnPassword(),Following::columnEmail(),Following::columnImage(),Following::columnPrivateFlag(),Following::columnCreatedAt(),Following::columnUpdatedAt(),Following::columnDeleteFlag(),Following::column StatusCount(),Following::columnFollowingCount(),Following::columnFollowerCount(),);24 return array(Following::columnId(),Following::columnName(),Following::columnPassword(),Following::columnEmail(),Following::columnImage(),Following::columnPrivateFlag(),Following::columnCreatedAt(),Following::columnUpdatedAt(),Following::columnDeleteFlag(),Following::columnHash(),Following::columnStatusCount(),Following::columnFollowingCount(),Following::columnFollowerCount(),); 19 25 } 20 26 function columnId(){ 21 return new Column(parent::columnId()); 27 if(!Rhaco::isVariable("_R_D_C_","Following::Id")){ 28 Rhaco::addVariable("_R_D_C_",new Column(parent::columnId()),"Following::Id"); 29 } 30 return Rhaco::getVariable("_R_D_C_",null,"Following::Id"); 22 31 } 23 32 function columnName(){ 24 return new Column(parent::columnName()); 33 if(!Rhaco::isVariable("_R_D_C_","Following::Name")){ 34 Rhaco::addVariable("_R_D_C_",new Column(parent::columnName()),"Following::Name"); 35 } 36 return Rhaco::getVariable("_R_D_C_",null,"Following::Name"); 25 37 } 26 38 function columnPassword(){ 27 return new Column(parent::columnPassword()); 39 if(!Rhaco::isVariable("_R_D_C_","Following::Password")){ 40 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPassword()),"Following::Password"); 41 } 42 return Rhaco::getVariable("_R_D_C_",null,"Following::Password"); 28 43 } 29 44 function columnEmail(){ 30 return new Column(parent::columnEmail()); 45 if(!Rhaco::isVariable("_R_D_C_","Following::Email")){ 46 Rhaco::addVariable("_R_D_C_",new Column(parent::columnEmail()),"Following::Email"); 47 } 48 return Rhaco::getVariable("_R_D_C_",null,"Following::Email"); 31 49 } 32 50 function columnImage(){ 33 return new Column(parent::columnImage()); 51 if(!Rhaco::isVariable("_R_D_C_","Following::Image")){ 52 Rhaco::addVariable("_R_D_C_",new Column(parent::columnImage()),"Following::Image"); 53 } 54 return Rhaco::getVariable("_R_D_C_",null,"Following::Image"); 34 55 } 35 56 function columnPrivateFlag(){ 36 return new Column(parent::columnPrivateFlag()); 57 if(!Rhaco::isVariable("_R_D_C_","Following::PrivateFlag")){ 58 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPrivateFlag()),"Following::PrivateFlag"); 59 } 60 return Rhaco::getVariable("_R_D_C_",null,"Following::PrivateFlag"); 37 61 } 38 62 function columnCreatedAt(){ 39 return new Column(parent::columnCreatedAt()); 63 if(!Rhaco::isVariable("_R_D_C_","Following::CreatedAt")){ 64 Rhaco::addVariable("_R_D_C_",new Column(parent::columnCreatedAt()),"Following::CreatedAt"); 65 } 66 return Rhaco::getVariable("_R_D_C_",null,"Following::CreatedAt"); 40 67 } 41 68 function columnUpdatedAt(){ 42 return new Column(parent::columnUpdatedAt()); 69 if(!Rhaco::isVariable("_R_D_C_","Following::UpdatedAt")){ 70 Rhaco::addVariable("_R_D_C_",new Column(parent::columnUpdatedAt()),"Following::UpdatedAt"); 71 } 72 return Rhaco::getVariable("_R_D_C_",null,"Following::UpdatedAt"); 43 73 } 44 74 function columnDeleteFlag(){ 45 return new Column(parent::columnDeleteFlag()); 75 if(!Rhaco::isVariable("_R_D_C_","Following::DeleteFlag")){ 76 Rhaco::addVariable("_R_D_C_",new Column(parent::columnDeleteFlag()),"Following::DeleteFlag"); 77 } 78 return Rhaco::getVariable("_R_D_C_",null,"Following::DeleteFlag"); 79 } 80 function columnHash(){ 81 if(!Rhaco::isVariable("_R_D_C_","Following::Hash")){ 82 Rhaco::addVariable("_R_D_C_",new Column(parent::columnHash()),"Following::Hash"); 83 } 84 return Rhaco::getVariable("_R_D_C_",null,"Following::Hash"); 46 85 } 47 86 function columnStatusCount(){ 48 return new Column(parent::columnStatusCount()); 87 if(!Rhaco::isVariable("_R_D_C_","Following::StatusCount")){ 88 Rhaco::addVariable("_R_D_C_",new Column(parent::columnStatusCount()),"Following::StatusCount"); 89 } 90 return Rhaco::getVariable("_R_D_C_",null,"Following::StatusCount"); 49 91 } 50 92 function columnFollowingCount(){ 51 return new Column(parent::columnFollowingCount()); 93 if(!Rhaco::isVariable("_R_D_C_","Following::FollowingCount")){ 94 Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowingCount()),"Following::FollowingCount"); 95 } 96 return Rhaco::getVariable("_R_D_C_",null,"Following::FollowingCount"); 52 97 } 53 98 function columnFollowerCount(){ 54 return new Column(parent::columnFollowerCount()); 99 if(!Rhaco::isVariable("_R_D_C_","Following::FollowerCount")){ 100 Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowerCount()),"Following::FollowerCount"); 101 } 102 return Rhaco::getVariable("_R_D_C_",null,"Following::FollowerCount"); 55 103 } 56 104 function setDependStandBys($value){ -
events/phpframework/rhaco/trunk/library/model/table/ReplytoTable.php
r14912 r15508 4 4 Rhaco::import("database.model.DbConnection"); 5 5 Rhaco::import("model.User"); 6 Rhaco::import("database.TableObjectUtil"); 7 Rhaco::import("database.model.Table"); 8 Rhaco::import("database.model.Column"); 6 9 /** 7 10 * #ignore … … 11 14 12 15 function table(){ 13 return new Table(parent::table(),__CLASS__); 16 if(!Rhaco::isVariable("_R_D_T_","Replyto")){ 17 Rhaco::addVariable("_R_D_T_",new Table(parent::table(),__CLASS__),"Replyto"); 18 } 19 return Rhaco::getVariable("_R_D_T_",null,"Replyto"); 14 20 } 15 21 function columns(){ 16 return array(Replyto::columnId(),Replyto::columnName(),Replyto::columnPassword(),Replyto::columnEmail(),Replyto::columnImage(),Replyto::columnPrivateFlag(),Replyto::columnCreatedAt(),Replyto::columnUpdatedAt(),Replyto::columnDeleteFlag(),Replyto::column StatusCount(),Replyto::columnFollowingCount(),Replyto::columnFollowerCount(),);22 return array(Replyto::columnId(),Replyto::columnName(),Replyto::columnPassword(),Replyto::columnEmail(),Replyto::columnImage(),Replyto::columnPrivateFlag(),Replyto::columnCreatedAt(),Replyto::columnUpdatedAt(),Replyto::columnDeleteFlag(),Replyto::columnHash(),Replyto::columnStatusCount(),Replyto::columnFollowingCount(),Replyto::columnFollowerCount(),); 17 23 } 18 24 function columnId(){ 19 return new Column(parent::columnId()); 25 if(!Rhaco::isVariable("_R_D_C_","Replyto::Id")){ 26 Rhaco::addVariable("_R_D_C_",new Column(parent::columnId()),"Replyto::Id"); 27 } 28 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Id"); 20 29 } 21 30 function columnName(){ 22 return new Column(parent::columnName()); 31 if(!Rhaco::isVariable("_R_D_C_","Replyto::Name")){ 32 Rhaco::addVariable("_R_D_C_",new Column(parent::columnName()),"Replyto::Name"); 33 } 34 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Name"); 23 35 } 24 36 function columnPassword(){ 25 return new Column(parent::columnPassword()); 37 if(!Rhaco::isVariable("_R_D_C_","Replyto::Password")){ 38 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPassword()),"Replyto::Password"); 39 } 40 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Password"); 26 41 } 27 42 function columnEmail(){ 28 return new Column(parent::columnEmail()); 43 if(!Rhaco::isVariable("_R_D_C_","Replyto::Email")){ 44 Rhaco::addVariable("_R_D_C_",new Column(parent::columnEmail()),"Replyto::Email"); 45 } 46 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Email"); 29 47 } 30 48 function columnImage(){ 31 return new Column(parent::columnImage()); 49 if(!Rhaco::isVariable("_R_D_C_","Replyto::Image")){ 50 Rhaco::addVariable("_R_D_C_",new Column(parent::columnImage()),"Replyto::Image"); 51 } 52 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Image"); 32 53 } 33 54 function columnPrivateFlag(){ 34 return new Column(parent::columnPrivateFlag()); 55 if(!Rhaco::isVariable("_R_D_C_","Replyto::PrivateFlag")){ 56 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPrivateFlag()),"Replyto::PrivateFlag"); 57 } 58 return Rhaco::getVariable("_R_D_C_",null,"Replyto::PrivateFlag"); 35 59 } 36 60 function columnCreatedAt(){ 37 return new Column(parent::columnCreatedAt()); 61 if(!Rhaco::isVariable("_R_D_C_","Replyto::CreatedAt")){ 62 Rhaco::addVariable("_R_D_C_",new Column(parent::columnCreatedAt()),"Replyto::CreatedAt"); 63 } 64 return Rhaco::getVariable("_R_D_C_",null,"Replyto::CreatedAt"); 38 65 } 39 66 function columnUpdatedAt(){ 40 return new Column(parent::columnUpdatedAt()); 67 if(!Rhaco::isVariable("_R_D_C_","Replyto::UpdatedAt")){ 68 Rhaco::addVariable("_R_D_C_",new Column(parent::columnUpdatedAt()),"Replyto::UpdatedAt"); 69 } 70 return Rhaco::getVariable("_R_D_C_",null,"Replyto::UpdatedAt"); 41 71 } 42 72 function columnDeleteFlag(){ 43 return new Column(parent::columnDeleteFlag()); 73 if(!Rhaco::isVariable("_R_D_C_","Replyto::DeleteFlag")){ 74 Rhaco::addVariable("_R_D_C_",new Column(parent::columnDeleteFlag()),"Replyto::DeleteFlag"); 75 } 76 return Rhaco::getVariable("_R_D_C_",null,"Replyto::DeleteFlag"); 77 } 78 function columnHash(){ 79 if(!Rhaco::isVariable("_R_D_C_","Replyto::Hash")){ 80 Rhaco::addVariable("_R_D_C_",new Column(parent::columnHash()),"Replyto::Hash"); 81 } 82 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Hash"); 44 83 } 45 84 function columnStatusCount(){ 46 return new Column(parent::columnStatusCount()); 85 if(!Rhaco::isVariable("_R_D_C_","Replyto::StatusCount")){ 86 Rhaco::addVariable("_R_D_C_",new Column(parent::columnStatusCount()),"Replyto::StatusCount"); 87 } 88 return Rhaco::getVariable("_R_D_C_",null,"Replyto::StatusCount"); 47 89 } 48 90 function columnFollowingCount(){ 49 return new Column(parent::columnFollowingCount()); 91 if(!Rhaco::isVariable("_R_D_C_","Replyto::FollowingCount")){ 92 Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowingCount()),"Replyto::FollowingCount"); 93 } 94 return Rhaco::getVariable("_R_D_C_",null,"Replyto::FollowingCount"); 50 95 } 51 96 function columnFollowerCount(){ 52 return new Column(parent::columnFollowerCount()); 97 if(!Rhaco::isVariable("_R_D_C_","Replyto::FollowerCount")){ 98 Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowerCount()),"Replyto::FollowerCount"); 99 } 100 return Rhaco::getVariable("_R_D_C_",null,"Replyto::FollowerCount"); 53 101 } 54 102 } -
events/phpframework/rhaco/trunk/library/model/table/StandByTable.php
r14912 r15508 3 3 Rhaco::import("database.model.TableObjectBase"); 4 4 Rhaco::import("database.model.DbConnection"); 5 Rhaco::import("database.TableObjectUtil"); 6 Rhaco::import("database.model.Table"); 7 Rhaco::import("database.model.Column"); 5 8 /** 6 9 * #ignore … … 31 34 } 32 35 function connection(){ 33 return new DbConnection("phwittr"); 36 if(!Rhaco::isVariable("_R_D_CON_","phwittr")){ 37 Rhaco::addVariable("_R_D_CON_",new DbConnection("phwittr"),"phwittr"); 38 } 39 return Rhaco::getVariable("_R_D_CON_",null,"phwittr"); 34 40 } 35 41 function table(){ 36 return new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."request",__CLASS__); 42 if(!Rhaco::isVariable("_R_D_T_","StandBy")){ 43 Rhaco::addVariable("_R_D_T_",new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."request",__CLASS__),"StandBy"); 44 } 45 return Rhaco::getVariable("_R_D_T_",null,"StandBy"); 37 46 } 38 47 /** … … 41 50 */ 42 51 function columnId(){ 43 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 44 $column->label(Message::_("id")); 45 return $column; 52 if(!Rhaco::isVariable("_R_D_C_","StandBy::Id")){ 53 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 54 $column->label(Message::_("id")); 55 Rhaco::addVariable("_R_D_C_",$column,"StandBy::Id"); 56 } 57 return Rhaco::getVariable("_R_D_C_",null,"StandBy::Id"); 46 58 } 47 /** */ 59 /** 60 * 61 * @return serial */ 48 62 function setId($value){ 49 63 $this->id = TableObjectUtil::cast($value,"serial"); 50 64 } 51 /** */ 65 /** 66 * 67 */ 52 68 function getId(){ 53 69 return $this->id; … … 58 74 */ 59 75 function columnUserId(){ 60 $column = new Column("column=user_id,variable=userId,type=integer,size=22,unique=true,reference=User::Id,uniqueWith=StandBy::RequestId,"); 61 $column->label(Message::_("user_id")); 62 return $column; 76 if(!Rhaco::isVariable("_R_D_C_","StandBy::UserId")){ 77 $column = new Column("column=user_id,variable=userId,type=integer,size=22,unique=true,reference=User::Id,uniqueWith=StandBy::RequestId,"); 78 $column->label(Message::_("user_id")); 79 Rhaco::addVariable("_R_D_C_",$column,"StandBy::UserId"); 80 } 81 return Rhaco::getVariable("_R_D_C_",null,"StandBy::UserId"); 63 82 } 64 /** */ 83 /** 84 * 85 * @return integer */ 65 86 function setUserId($value){ 66 87 $this->userId = TableObjectUtil::cast($value,"integer"); 67 88 } 68 /** */ 89 /** 90 * 91 */ 69 92 function getUserId(){ 70 93 return $this->userId; … … 75 98 */ 76 99 function columnRequestId(){ 77 $column = new Column("column=request_id,variable=requestId,type=integer,size=22,require=true,unique=true,reference=Following::Id,uniqueWith=StandBy::UserId,"); 78 $column->label(Message::_("request_id")); 79 return $column; 100 if(!Rhaco::isVariable("_R_D_C_","StandBy::RequestId")){ 101 $column = new Column("column=request_id,variable=requestId,type=integer,size=22,require=true,unique=true,reference=Following::Id,uniqueWith=StandBy::UserId,"); 102 $column->label(Message::_("request_id")); 103 Rhaco::addVariable("_R_D_C_",$column,"StandBy::RequestId"); 104 } 105 return Rhaco::getVariable("_R_D_C_",null,"StandBy::RequestId"); 80 106 } 81 /** */ 107 /** 108 * 109 * @return integer */ 82 110 function setRequestId($value){ 83 111 $this->requestId = TableObjectUtil::cast($value,"integer"); 84 112 } 85 /** */ 113 /** 114 * 115 */ 86 116 function getRequestId(){ 87 117 return $this->requestId; … … 92 122 */ 93 123 function columnCreatedAt(){ 94 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 95 $column->label(Message::_("created_at")); 96 return $column; 124 if(!Rhaco::isVariable("_R_D_C_","StandBy::CreatedAt")){ 125 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 126 $column->label(Message::_("created_at")); 127 Rhaco::addVariable("_R_D_C_",$column,"StandBy::CreatedAt"); 128 } 129 return Rhaco::getVariable("_R_D_C_",null,"StandBy::CreatedAt"); 97 130 } 98 /** */ 131 /** 132 * 133 * @return timestamp */ 99 134 function setCreatedAt($value){ 100 135 $this->createdAt = TableObjectUtil::cast($value,"timestamp"); 101 136 } 102 /** */ 137 /** 138 * 139 */ 103 140 function getCreatedAt(){ 104 141 return $this->createdAt; -
events/phpframework/rhaco/trunk/library/model/table/StatusTable.php
r14912 r15508 3 3 Rhaco::import("database.model.TableObjectBase"); 4 4 Rhaco::import("database.model.DbConnection"); 5 Rhaco::import("database.TableObjectUtil"); 6 Rhaco::import("database.model.Table"); 7 Rhaco::import("database.model.Column"); 5 8 /** 6 9 * #ignore … … 35 38 } 36 39 function connection(){ 37 return new DbConnection("phwittr"); 40 if(!Rhaco::isVariable("_R_D_CON_","phwittr")){ 41 Rhaco::addVariable("_R_D_CON_",new DbConnection("phwittr"),"phwittr"); 42 } 43 return Rhaco::getVariable("_R_D_CON_",null,"phwittr"); 38 44 } 39 45 function table(){ 40 return new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."status",__CLASS__); 46 if(!Rhaco::isVariable("_R_D_T_","Status")){ 47 Rhaco::addVariable("_R_D_T_",new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."status",__CLASS__),"Status"); 48 } 49 return Rhaco::getVariable("_R_D_T_",null,"Status"); 41 50 } 42 51 /** … … 45 54 */ 46 55 function columnId(){ 47 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 48 $column->label(Message::_("id")); 49 return $column; 50 } 51 /** */ 56 if(!Rhaco::isVariable("_R_D_C_","Status::Id")){ 57 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 58 $column->label(Message::_("id")); 59 Rhaco::addVariable("_R_D_C_",$column,"Status::Id"); 60 } 61 return Rhaco::getVariable("_R_D_C_",null,"Status::Id"); 62 } 63 /** 64 * 65 * @return serial */ 52 66 function setId($value){ 53 67 $this->id = TableObjectUtil::cast($value,"serial"); 54 68 } 55 /** */ 69 /** 70 * 71 */ 56 72 function getId(){ 57 73 return $this->id; … … 62 78 */ 63 79 function columnUserId(){ 64 $column = new Column("column=user_id,variable=userId,type=integer,size=22,reference=User::Id,"); 65 $column->label(Message::_("user_id")); 66 return $column; 67 } 68 /** */ 80 if(!Rhaco::isVariable("_R_D_C_","Status::UserId")){ 81 $column = new Column("column=user_id,variable=userId,type=integer,size=22,reference=User::Id,"); 82 $column->label(Message::_("user_id")); 83 Rhaco::addVariable("_R_D_C_",$column,"Status::UserId"); 84 } 85 return Rhaco::getVariable("_R_D_C_",null,"Status::UserId"); 86 } 87 /** 88 * 89 * @return integer */ 69 90 function setUserId($value){ 70 91 $this->userId = TableObjectUtil::cast($value,"integer"); 71 92 } 72 /** */ 93 /** 94 * 95 */ 73 96 function getUserId(){ 74 97 return $this->userId; … … 79 102 */ 80 103 function columnComment(){ 81 $column = new Column("column=comment,variable=comment,type=string,size=140,require=true,"); 82 $column->label(Message::_("comment")); 83 return $column; 84 } 85 /** */ 104 if(!Rhaco::isVariable("_R_D_C_","Status::Comment")){ 105 $column = new Column("column=comment,variable=comment,type=string,size=140,require=true,"); 106 $column->label(Message::_("comment")); 107 Rhaco::addVariable("_R_D_C_",$column,"Status::Comment"); 108 } 109 return Rhaco::getVariable("_R_D_C_",null,"Status::Comment"); 110 } 111 /** 112 * 113 * @return string */ 86 114 function setComment($value){ 87 115 $this->comment = TableObjectUtil::cast($value,"string"); 88 116 } 89 /** */ 117 /** 118 * 119 */ 90 120 function getComment(){ 91 121 return $this->comment; … … 96 126 */ 97 127 function columnReplyUserId(){ 98 $column = new Column("column=reply_user_id,variable=replyUserId,type=integer,size=22,"); 99 $column->label(Message::_("reply_user_id")); 100 return $column; 101 } 102 /** */ 128 if(!Rhaco::isVariable("_R_D_C_","Status::ReplyUserId")){ 129 $column = new Column("column=reply_user_id,variable=replyUserId,type=integer,size=22,"); 130 $column->label(Message::_("reply_user_id")); 131 Rhaco::addVariable("_R_D_C_",$column,"Status::ReplyUserId"); 132 } 133 return Rhaco::getVariable("_R_D_C_",null,"Status::ReplyUserId"); 134 } 135 /** 136 * 137 * @return integer */ 103 138 function setReplyUserId($value){ 104 139 $this->replyUserId = TableObjectUtil::cast($value,"integer"); 105 140 } 106 /** */ 141 /** 142 * 143 */ 107 144 function getReplyUserId(){ 108 145 return $this->replyUserId; … … 113 150 */ 114 151 function columnCreatedAt(){ 115 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 116 $column->label(Message::_("created_at")); 117 return $column; 118 } 119 /** */ 152 if(!Rhaco::isVariable("_R_D_C_","Status::CreatedAt")){ 153 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 154 $column->label(Message::_("created_at")); 155 Rhaco::addVariable("_R_D_C_",$column,"Status::CreatedAt"); 156 } 157 return Rhaco::getVariable("_R_D_C_",null,"Status::CreatedAt"); 158 } 159 /** 160 * 161 * @return timestamp */ 120 162 function setCreatedAt($value){ 121 163 $this->createdAt = TableObjectUtil::cast($value,"timestamp"); 122 164 } 123 /** */ 165 /** 166 * 167 */ 124 168 function getCreatedAt(){ 125 169 return $this->createdAt; … … 138 182 return $column; 139 183 } 140 /** */ 184 /** 185 * 186 * @return string */ 141 187 function setReplyUserName($value){ 142 188 $this->replyUserName = TableObjectUtil::cast($value,"string"); 143 189 } 144 /** */ 190 /** 191 * 192 */ 145 193 function getReplyUserName(){ 146 194 return $this->replyUserName; -
events/phpframework/rhaco/trunk/library/model/table/TmpRegistrationTable.php
r14912 r15508 3 3 Rhaco::import("database.model.TableObjectBase"); 4 4 Rhaco::import("database.model.DbConnection"); 5 Rhaco::import("database.TableObjectUtil"); 6 Rhaco::import("database.model.Table"); 7 Rhaco::import("database.model.Column"); 5 8 /** 6 9 * #ignore … … 35 38 } 36 39 function connection(){ 37 return new DbConnection("phwittr"); 40 if(!Rhaco::isVariable("_R_D_CON_","phwittr")){ 41 Rhaco::addVariable("_R_D_CON_",new DbConnection("phwittr"),"phwittr"); 42 } 43 return Rhaco::getVariable("_R_D_CON_",null,"phwittr"); 38 44 } 39 45 function table(){ 40 return new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."tmp_registration",__CLASS__); 46 if(!Rhaco::isVariable("_R_D_T_","TmpRegistration")){ 47 Rhaco::addVariable("_R_D_T_",new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."tmp_registration",__CLASS__),"TmpRegistration"); 48 } 49 return Rhaco::getVariable("_R_D_T_",null,"TmpRegistration"); 41 50 } 42 51 /** … … 45 54 */ 46 55 function columnId(){ 47 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 48 $column->label(Message::_("id")); 49 return $column; 50 } 51 /** */ 56 if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::Id")){ 57 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 58 $column->label(Message::_("id")); 59 Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::Id"); 60 } 61 return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::Id"); 62 } 63 /** 64 * 65 * @return serial */ 52 66 function setId($value){ 53 67 $this->id = TableObjectUtil::cast($value,"serial"); 54 68 } 55 /** */ 69 /** 70 * 71 */ 56 72 function getId(){ 57 73 return $this->id; … … 62 78 */ 63 79 function columnName(){ 64 $column = new Column("column=name,variable=name,type=string,size=30,require=true,unique=true,chartype=/^[A-Za-z0-9_-]+$/,"); 65 $column->label(Message::_("name")); 66 return $column; 67 } 68 /** */ 80 if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::Name")){ 81 $column = new Column("column=name,variable=name,type=string,size=30,require=true,unique=true,chartype=/^[A-Za-z0-9_-]+$/,"); 82 $column->label(Message::_("name")); 83 Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::Name"); 84 } 85 return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::Name"); 86 } 87 /** 88 * 89 * @return string */ 69 90 function setName($value){ 70 91 $this->name = TableObjectUtil::cast($value,"string"); 71 92 } 72 /** */ 93 /** 94 * 95 */ 73 96 function getName(){ 74 97 return $this->name; … … 79 102 */ 80 103 function columnPassword(){ 81 $column = new Column("column=password,variable=password,type=string,size=100,require=true,"); 82 $column->label(Message::_("password")); 83 return $column; 84 } 85 /** */ 104 if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::Password")){ 105 $column = new Column("column=password,variable=password,type=string,size=100,require=true,"); 106 $column->label(Message::_("password")); 107 Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::Password"); 108 } 109 return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::Password"); 110 } 111 /** 112 * 113 * @return string */ 86 114 function setPassword($value){ 87 115 $this->password = TableObjectUtil::cast($value,"string"); 88 116 } 89 /** */ 117 /** 118 * 119 */ 90 120 function getPassword(){ 91 121 return $this->password; … … 96 126 */ 97 127 function columnEmail(){ 98 $column = new Column("column=email,variable=email,type=email,size=255,require=true,"); 99 $column->label(Message::_("email")); 100 return $column; 101 } 102 /** */ 128 if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::Email")){ 129 $column = new Column("column=email,variable=email,type=email,size=255,require=true,"); 130 $column->label(Message::_("email")); 131 Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::Email"); 132 } 133 return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::Email"); 134 } 135 /** 136 * 137 * @return email */ 103 138 function setEmail($value){ 104 139 $this->email = TableObjectUtil::cast($value,"email"); 105 140 } 106 /** */ 141 /** 142 * 143 */ 107 144 function getEmail(){ 108 145 return $this->email; … … 113 150 */ 114 151 function columnHash(){ 115 $column = new Column("column=hash,variable=hash,type=string,"); 116 $column->label(Message::_("hash")); 117 return $column; 118 } 119 /** */ 152 if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::Hash")){ 153 $column = new Column("column=hash,variable=hash,type=string,"); 154 $column->label(Message::_("hash")); 155 Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::Hash"); 156 } 157 return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::Hash"); 158 } 159 /** 160 * 161 * @return string */ 120 162 function setHash($value){ 121 163 $this->hash = TableObjectUtil::cast($value,"string"); 122 164 } 123 /** */ 165 /** 166 * 167 */ 124 168 function getHash(){ 125 169 return $this->hash; … … 130 174 */ 131 175 function columnCreatedAt(){ 132 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 133 $column->label(Message::_("created_at")); 134 return $column; 135 } 136 /** */ 176 if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::CreatedAt")){ 177 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 178 $column->label(Message::_("created_at")); 179 Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::CreatedAt"); 180 } 181 return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::CreatedAt"); 182 } 183 /** 184 * 185 * @return timestamp */ 137 186 function setCreatedAt($value){ 138 187 $this->createdAt = TableObjectUtil::cast($value,"timestamp"); 139 188 } 140 /** */ 189 /** 190 * 191 */ 141 192 function getCreatedAt(){ 142 193 return $this->createdAt; -
events/phpframework/rhaco/trunk/library/model/table/UserTable.php
r14912 r15508 3 3 Rhaco::import("database.model.TableObjectBase"); 4 4 Rhaco::import("database.model.DbConnection"); 5 Rhaco::import("database.TableObjectUtil"); 6 Rhaco::import("database.model.Table"); 7 Rhaco::import("database.model.Column"); 5 8 /** 6 9 * #ignore … … 26 29 /** */ 27 30 var $deleteFlag; 31 /** */ 32 var $hash; 28 33 /** */ 29 34 var $statusCount; … … 51 56 $this->updatedAt = time(); 52 57 $this->deleteFlag = 0; 58 $this->hash = null; 53 59 $this->statusCount = 0; 54 60 $this->followingCount = 0; … … 57 63 } 58 64 function connection(){ 59 return new DbConnection("phwittr"); 65 if(!Rhaco::isVariable("_R_D_CON_","phwittr")){ 66 Rhaco::addVariable("_R_D_CON_",new DbConnection("phwittr"),"phwittr"); 67 } 68 return Rhaco::getVariable("_R_D_CON_",null,"phwittr"); 60 69 } 61 70 function table(){ 62 return new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."user",__CLASS__); 71 if(!Rhaco::isVariable("_R_D_T_","User")){ 72 Rhaco::addVariable("_R_D_T_",new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."user",__CLASS__),"User"); 73 } 74 return Rhaco::getVariable("_R_D_T_",null,"User"); 63 75 } 64 76 /** … … 67 79 */ 68 80 function columnId(){ 69 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 70 $column->label(Message::_("id")); 71 $column->depend("Status::UserId","Follow::UserId","StandBy::UserId"); 72 return $column; 73 } 74 /** */ 81 if(!Rhaco::isVariable("_R_D_C_","User::Id")){ 82 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 83 $column->label(Message::_("id")); 84 $column->depend("Status::UserId","Follow::UserId","StandBy::UserId"); 85 Rhaco::addVariable("_R_D_C_",$column,"User::Id"); 86 } 87 return Rhaco::getVariable("_R_D_C_",null,"User::Id"); 88 } 89 /** 90 * 91 * @return serial */ 75 92 function setId($value){ 76 93 $this->id = TableObjectUtil::cast($value,"serial"); 77 94 } 78 /** */ 95 /** 96 * 97 */ 79 98 function getId(){ 80 99 return $this->id; … … 85 104 */ 86 105 function columnName(){ 87 $column = new Column("column=name,variable=name,type=string,size=30,require=true,unique=true,chartype=/^[A-Za-z0-9_-]+$/,"); 88 $column->label(Message::_("name")); 89 return $column; 90 } 91 /** */ 106 if(!Rhaco::isVariable("_R_D_C_","User::Name")){ 107 $column = new Column("column=name,variable=name,type=string,size=30,require=true,unique=true,chartype=/^[A-Za-z0-9_-]+$/,"); 108 $column->label(Message::_("name")); 109 Rhaco::addVariable("_R_D_C_",$column,"User::Name"); 110 } 111 return Rhaco::getVariable("_R_D_C_",null,"User::Name"); 112 } 113 /** 114 * 115 * @return string */ 92 116 function setName($value){ 93 117 $this->name = TableObjectUtil::cast($value,"string"); 94 118 } 95 /** */ 119 /** 120 * 121 */ 96 122 function getName(){ 97 123 return $this->name; … … 102 128 */ 103 129 function columnPassword(){ 104 $column = new Column("column=password,variable=password,type=string,size=100,require=true,"); 105 $column->label(Message::_("password")); 106 return $column; 107 } 108 /** */ 130 if(!Rhaco::isVariable("_R_D_C_","User::Password")){ 131 $column = new Column("column=password,variable=password,type=string,size=100,require=true,"); 132 $column->label(Message::_("password")); 133 Rhaco::addVariable("_R_D_C_",$column,"User::Password"); 134 } 135 return Rhaco::getVariable("_R_D_C_",null,"User::Password"); 136 } 137 /** 138 * 139 * @return string */ 109 140 function setPassword($value){ 110 141 $this->password = TableObjectUtil::cast($value,"string"); 111 142 } 112 /** */ 143 /** 144 * 145 */ 113 146 function getPassword(){ 114 147 return $this->password; … … 119 152 */ 120 153 function columnEmail(){ 121 $column = new Column("column=email,variable=email,type=email,size=255,require=true,"); 122 $column->label(Message::_("email")); 123 return $column; 124 } 125 /** */ 154 if(!Rhaco::isVariable("_R_D_C_","User::Email")){ 155 $column = new Column("column=email,variable=email,type=email,size=255,require=true,"); 156 $column->label(Message::_("email")); 157 Rhaco::addVariable("_R_D_C_",$column,"User::Email"); 158 } 159 return Rhaco::getVariable("_R_D_C_",null,"User::Email"); 160 } 161 /** 162 * 163 * @return email */ 126 164 function setEmail($value){ 127 165 $this->email = TableObjectUtil::cast($value,"email"); 128 166 } 129 /** */ 167 /** 168 * 169 */ 130 170 function getEmail(){ 131 171 return $this->email; … … 136 176 */ 137 177 function columnImage(){ 138 $column = new Column("column=image,variable=image,type=string,size=50,"); 139 $column->label(Message::_("image")); 140 return $column; 141 } 142 /** */ 178 if(!Rhaco::isVariable("_R_D_C_","User::Image")){ 179 $column = new Column("column=image,variable=image,type=string,size=50,"); 180 $column->label(Message::_("image")); 181 Rhaco::addVariable("_R_D_C_",$column,"User::Image"); 182 } 183 return Rhaco::getVariable("_R_D_C_",null,"User::Image"); 184 } 185 /** 186 * 187 * @return string */ 143 188 function setImage($value){ 144 189 $this->image = TableObjectUtil::cast($value,"string"); 145 190 } 146 /** */ 191 /** 192 * 193 */ 147 194 function getImage(){ 148 195 return $this->image; … … 153 200 */ 154 201 function columnPrivateFlag(){ 155 $column = new Column("column=private_flag,variable=privateFlag,type=boolean,"); 156 $column->label(Message::_("private_flag")); 157 return $column; 158 } 159 /** */ 202 if(!Rhaco::isVariable("_R_D_C_","User::PrivateFlag")){ 203 $column = new Column("column=private_flag,variable=privateFlag,type=boolean,"); 204 $column->label(Message::_("private_flag")); 205 Rhaco::addVariable("_R_D_C_",$column,"User::PrivateFlag"); 206 } 207 return Rhaco::getVariable("_R_D_C_",null,"User::PrivateFlag"); 208 } 209 /** 210 * 211 * @return boolean */ 160 212 function setPrivateFlag($value){ 161 213 $this->privateFlag = TableObjectUtil::cast($value,"boolean"); 162 214 } 163 /** */ 215 /** 216 * 217 */ 164 218 function getPrivateFlag(){ 165 219 return $this->privateFlag; 166 220 } 221 /** */ 222 function isPrivateFlag(){ 223 return $this->privateFlag; 224 } 167 225 /** 168 226 * … … 170 228 */ 171 229 function columnCreatedAt(){ 172 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 173 $column->label(Message::_("created_at")); 174 return $column; 175 } 176 /** */ 230 if(!Rhaco::isVariable("_R_D_C_","User::CreatedAt")){ 231 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 232 $column->label(Message::_("created_at")); 233 Rhaco::addVariable("_R_D_C_",$column,"User::CreatedAt"); 234 } 235 return Rhaco::getVariable("_R_D_C_",null,"User::CreatedAt"); 236 } 237 /** 238 * 239 * @return timestamp */ 177 240 function setCreatedAt($value){ 178 241 $this->createdAt = TableObjectUtil::cast($value,"timestamp"); 179 242 } 180 /** */ 243 /** 244 * 245 */ 181 246 function getCreatedAt(){ 182 247 return $this->createdAt; … … 191 256 */ 192 257 function columnUpdatedAt(){ 193 $column = new Column("column=updated_at,variable=updatedAt,type=timestamp,"); 194 $column->label(Message::_("updated_at")); 195 return $column; 196 } 197 /** */ 258 if(!Rhaco::isVariable("_R_D_C_","User::UpdatedAt")){ 259 $column = new Column("column=updated_at,variable=updatedAt,type=timestamp,"); 260 $column->label(Message::_("updated_at")); 261 Rhaco::addVariable("_R_D_C_",$column,"User::UpdatedAt"); 262 } 263 return Rhaco::getVariable("_R_D_C_",null,"User::UpdatedAt"); 264 } 265 /** 266 * 267 * @return timestamp */ 198 268 function setUpdatedAt($value){ 199 269 $this->updatedAt = TableObjectUtil::cast($value,"timestamp"); 200 270 } 201 /** */ 271 /** 272 * 273 */ 202 274 function getUpdatedAt(){ 203 275 return $this->updatedAt; … … 212 284 */ 213 285 function columnDeleteFlag(){ 214 $column = new Column("column=delete_flag,variable=deleteFlag,type=boolean,"); 215 $column->label(Message::_("delete_flag")); 216 return $column; 217 } 218 /** */ 286 if(!Rhaco::isVariable("_R_D_C_","User::DeleteFlag")){ 287 $column = new Column("column=delete_flag,variable=deleteFlag,type=boolean,"); 288 $column->label(Message::_("delete_flag")); 289 Rhaco::addVariable("_R_D_C_",$column,"User::DeleteFlag"); 290 } 291 return Rhaco::getVariable("_R_D_C_",null,"User::DeleteFlag"); 292 } 293 /** 294 * 295 * @return boolean */ 219 296 function setDeleteFlag($value){ 220 297 $this->deleteFlag = TableObjectUtil::cast($value,"boolean"); 221 298 } 222 /** */ 299 /** 300 * 301 */ 223 302 function getDeleteFlag(){ 224 303 return $this->deleteFlag; 225 304 } 305 /** */ 306 function isDeleteFlag(){ 307 return $this->deleteFlag; 308 } 309 /** 310 * 311 * @return database.model.Column 312 */ 313 function columnHash(){ 314 if(!Rhaco::isVariable("_R_D_C_","User::Hash")){ 315 $column = new Column("column=hash,variable=hash,type=string,"); 316 $column->label(Message::_("hash")); 317 Rhaco::addVariable("_R_D_C_",$column,"User::Hash"); 318 } 319 return Rhaco::getVariable("_R_D_C_",null,"User::Hash"); 320 } 321 /** 322 * 323 * @return string */ 324 function setHash($value){ 325 $this->hash = TableObjectUtil::cast($value,"string"); 326 } 327 /** 328 * 329 */ 330 function getHash(){ 331 return $this->hash; 332 } 226 333 /** 227 334 * … … 229 336 */ 230 337 function columnStatusCount(){ 231 $column = new Column("column=status_count,variable=statusCount,type=integer,size=22,"); 232 $column->label(Message::_("status_count")); 233 return $column; 234 } 235 /** */ 338 if(!Rhaco::isVariable("_R_D_C_","User::StatusCount")){ 339 $column = new Column("column=status_count,variable=statusCount,type=integer,size=22,"); 340 $column->label(Message::_("status_count")); 341 Rhaco::addVariable("_R_D_C_",$column,"User::StatusCount"); 342 } 343 return Rhaco::getVariable("_R_D_C_",null,"User::StatusCount"); 344 } 345 /** 346 * 347 * @return integer */ 236 348 function setStatusCount($value){ 237 349 $this->statusCount = TableObjectUtil::cast($value,"integer"); 238 350 } 239 /** */ 351 /** 352 * 353 */ 240 354 function getStatusCount(){ 241 355 return $this->statusCount; … … 246 360 */ 247 361 function columnFollowingCount(){ 248 $column = new Column("column=following_count,variable=followingCount,type=integer,size=22,"); 249 $column->label(Message::_("following_count")); 250 return $column; 251 } 252 /** */ 362 if(!Rhaco::isVariable("_R_D_C_","User::FollowingCount")){ 363 $column = new Column("column=following_count,variable=followingCount,type=integer,size=22,"); 364 $column->label(Message::_("following_count")); 365 Rhaco::addVariable("_R_D_C_",$column,"User::FollowingCount"); 366 } 367 return Rhaco::getVariable("_R_D_C_",null,"User::FollowingCount"); 368 } 369 /** 370 * 371 * @return integer */ 253 372 function setFollowingCount($value){ 254 373 $this->followingCount = TableObjectUtil::cast($value,"integer"); 255 374 } 256 /** */ 375 /** 376 * 377 */ 257 378 function getFollowingCount(){ 258 379 return $this->followingCount; … … 263 384 */ 264 385 function columnFollowerCount(){ 265 $column = new Column("column=follower_count,variable=followerCount,type=integer,size=22,"); 266 $column->label(Message::_("follower_count")); 267 return $column; 268 } 269 /** */ 386 if(!Rhaco::isVariable("_R_D_C_","User::FollowerCount")){ 387 $column = new Column("column=follower_count,variable=followerCount,type=integer,size=22,"); 388 $column->label(Message::_("follower_count")); 389 Rhaco::addVariable("_R_D_C_",$column,"User::FollowerCount"); 390 } 391 return Rhaco::getVariable("_R_D_C_",null,"User::FollowerCount"); 392 } 393 /** 394 * 395 * @return integer */ 270 396 function setFollowerCount($value){ 271 397 $this->followerCount = TableObjectUtil::cast($value,"integer"); 272 398 } 273 /** */ 399 /** 400 * 401 */ 274 402 function getFollowerCount(){ 275 403 return $this->followerCount; -
events/phpframework/rhaco/trunk/resources/templates/default/js/application.js
r14159 r15508 48 48 } else { 49 49 status_countup(); 50 status_load(response['status'] );50 status_load(response['status'], response['user']); 51 51 } 52 52 }, … … 58 58 }); 59 59 60 function status_load(status ){60 function status_load(status, user){ 61 61 $('#timelines').prepend( 62 '<dt>' + status['user'] + "</dt>\n" 62 '<dt><a href="'+phwittr_url+user['name']+'"><img src="'+phwittr_url+'picture/thumbnail/'+user['image'] 63 + '" width="48" height="48" alt="'+user['name']+'"/></a> ' 64 + '<a href="'+phwittr_url+user['name']+'">' + user['name'] + "</a></dt>\n" 63 65 + '<dd>' + status['comment'] + "</dd>\n" 64 66 + '<dd class="meta"><a href="'+phwittr_url+'statuses/'+status['id']+'">' + status['createdAt'] + "</a>" + status['replyTo'] 65 67 + "</dd>\n" 66 68 ); 69 // わからん。やり方教えれ。 70 // window.Hatena.Star.EntryLoader.loadNewEntries($('#timelines dd').get()[0]); 67 71 } 68 72 -
events/phpframework/rhaco/trunk/resources/templates/default/layout.html
r14534 r15508 23 23 } 24 24 }; 25 <rt:if param="{$notice}"> 26 $(function(){ 27 notice('{$notice}'); 28 }); 29 </rt:if> 25 30 </script> 26 31 <title><rt:block name="title">{$rhaco.constant('SITE_NAME')}</rt:block></title> -
events/phpframework/rhaco/trunk/setup/project.xml
r14912 r15508 13 13 <column name="delete_flag" type="boolean" default="0" /> 14 14 <!-- 以下、勝手に追加 --> 15 <column name="hash" type="string" /> 15 16 <column name="status_count" type="integer" default="0" /> 16 17 <column name="following_count" type="integer" default="0" />
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)