Changeset 701 for trunk/app/models
- Timestamp:
- 08/08/08 16:03:49 (4 months ago)
- Location:
- trunk/app/models
- Files:
-
- 5 modified
-
answer.php (modified) (2 diffs)
-
catglossary.php (modified) (2 diffs)
-
entry.php (modified) (3 diffs)
-
lesson.php (modified) (1 diff)
-
news.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/models/answer.php
r365 r701 8 8 class Answer extends AppModel { 9 9 10 public $belongsTo = array('Question' =>10 public $belongsTo = array('Question' => 11 11 array('className' => 'Question', 12 12 'conditions' => '', … … 16 16 ); 17 17 18 public $validate = array( 19 'comment' => VALID_NOT_EMPTY, 20 'user_id' => VALID_NOT_EMPTY, 21 'entry_id' => VALID_NOT_EMPTY, 22 'username' => VALID_NOT_EMPTY 23 ); 24 18 19 public $validate = array( 20 'answer' => array( 21 'rule' => array('minLength', 2), 22 'message' => 'Answer must be at least two characters long', 23 'allowEmpty' => false, 24 'required' => true 25 ), 26 'correct' => array( 27 'rule' => 'numeric', 28 'allowEmpty' => false, 29 'required' => true 30 ), 31 'question_id' => array( 32 'rule' => 'numeric', 33 'allowEmpty' => false, 34 'required' => true 35 ), 36 'user_id' => array( 37 'rule' => 'numeric', 38 'allowEmpty' => false, 39 'required' => true 40 ) 41 ); 25 42 } 26 43 ?> -
trunk/app/models/catglossary.php
r282 r701 8 8 class Catglossary extends AppModel 9 9 { 10 public $name = 'Catglossary';10 public $name = 'Catglossary'; 11 11 12 public $belongsTo = array('User' =>12 public $belongsTo = array('User' => 13 13 array('className' => 'User', 14 14 'conditions' => null, … … 20 20 ); 21 21 22 public $hasMany = array('Glossary' =>22 public $hasMany = array('Glossary' => 23 23 array('className' => 'Glossary', 24 'foreignKey' => 'catglossary_id' 24 'foreignKey' => 'catglossary_id', 25 'order' => 'item' 25 26 ) 26 27 ); 27 28 28 29 29 public $validate = array( 30 'title' => VALID_NOT_EMPTY, 31 'description' => VALID_NOT_EMPTY, 32 'user_id' => VALID_NOT_EMPTY, 33 'status' => VALID_NOT_EMPTY 30 public $validate = array( 31 'title' => array( 32 'rule' => array('minLength', 8), 33 'message' => 'Title must be at least 8 characters long', 34 'allowEmpty' => false, 35 'required' => true 36 ), 37 38 'description' => array( 39 'rule' => array('minLength', 8), 40 'message' => 'Title must be at least 8 characters long', 41 'allowEmpty' => false, 42 'required' => true 43 ) 34 44 ); 35 36 45 } 37 38 46 ?> -
trunk/app/models/entry.php
r593 r701 5 5 { 6 6 7 public $belongsTo = array('User' =>7 public $belongsTo = array('User' => 8 8 array('className' => 'User', 9 9 'conditions' => '', … … 19 19 ); 20 20 21 public $hasMany = array('Comment' =>21 public $hasMany = array('Comment' => 22 22 array('className' => 'Comment', 23 23 'conditions' => null, … … 30 30 ) 31 31 ); 32 33 public $validate = array( 34 'title' => VALID_NOT_EMPTY, //'/[a-z0-9\_\-]{3,}$/i', 35 'user_id' => VALID_NOT_EMPTY, 36 'body' => VALID_NOT_EMPTY, 37 'status' => VALID_NOT_EMPTY 32 33 public $validate = array( 34 'title' => array( 35 'rule' => array('minLength', 4), 36 'message' => 'Title must be at least four characters long', 37 'allowEmpty' => false, 38 'required' => true 39 ), 40 41 'body' => array( 42 'rule' => array('minLength', 8), 43 'message' => 'Entry must be at least 8 characters long', 44 'allowEmpty' => false, 45 'required' => true 46 ) 38 47 ); 39 48 40 public function getComments($blogger_id) 41 { 42 49 public function getComments($blogger_id) 50 { 43 51 $conditions = array('Entry.user_id'=>$blogger_id); 44 52 $fields = array('Entry.title', 'Entry.id'); -
trunk/app/models/lesson.php
r632 r701 37 37 ); 38 38 39 public $validate = array( 40 'title' => VALID_NOT_EMPTY, //'/[a-z0-9\_\-]{3,}$/i', 41 'body' => VALID_NOT_EMPTY, 42 'user_id' => VALID_NOT_EMPTY 39 public $validate = array( 40 'title' => array( 41 'rule' => array('minLength', 4), 42 'message' => 'Title must be at least four characters long', 43 'allowEmpty' => false, 44 'required' => true 45 ), 46 47 'body' => array( 48 'rule' => array('minLength', 8), 49 'message' => 'Entry must be at least 8 characters long', 50 'allowEmpty' => false, 51 'required' => true 52 ), 53 'user_id' => array( 54 'rule' => 'numeric', 55 'allowEmpty' => false, 56 'required' => true 57 ) 43 58 ); 44 /*45 public $validate = array(46 'login' => array('alphanumeric' => array(47 'rule' => 'alphaNumeric',48 'required' => true,49 'message' => 'Alphabets and numbers only'50 ),51 'between' => array(52 'rule' => array('between', 5, 15),53 'message' => 'Between 5 to 15 characters'54 )55 ),56 'password' => array(57 'rule' => array('minLength', '8'),58 'message' => 'Mimimum 8 characters long'59 ),60 'email' => 'email',61 'born' => array(62 'rule' => 'date',63 'message' => 'Enter a valid date',64 'allowEmpty' => true65 )66 ); */67 59 } 68 60 ?> -
trunk/app/models/news.php
r537 r701 32 32 ); 33 33 34 public $validate = array(35 'title' => VALID_NOT_EMPTY,36 'user_id' => VALID_NOT_EMPTY,37 'body' => VALID_NOT_EMPTY,38 'status' => VALID_NOT_EMPTY39 );40 /*41 34 public $validate = array( 42 'login' => array('alphanumeric' => array( 43 'rule' => 'alphaNumeric', 44 'required' => true, 45 'message' => 'Alphabets and numbers only' 46 ), 47 'between' => array( 48 'rule' => array('between', 5, 15), 49 'message' => 'Between 5 to 15 characters' 50 ) 51 ), 52 'password' => array( 53 'rule' => array('minLength', '8'), 54 'message' => 'Mimimum 8 characters long' 55 ), 56 'email' => 'email', 57 'born' => array( 58 'rule' => 'date', 59 'message' => 'Enter a valid date', 60 'allowEmpty' => true 61 ) 62 ); */ 35 'title' => array( 36 'rule' => array('minLength', 4), 37 'message' => 'Title must be at least four characters long', 38 'allowEmpty' => false, 39 'required' => true 40 ), 41 'body' => array( 42 'rule' => array('minLength', 8), 43 'message' => 'Entry must be at least 8 characters long', 44 'allowEmpty' => false, 45 'required' => true 46 ), 47 'reference' => array( 48 'rule' => 'url', 49 'allowEmpty' => true, 50 'required' => false, 51 'message' => 'Your URL format lucks incorrect', 52 ), 53 'theme_id' => array( 54 'rule' => 'numeric', 55 'allowEmpty' => false, 56 'required' => true 57 ) 58 ); 63 59 } 64 60 ?>
