LonelyThinker /models/link.php

Language PHP Lines 45
MD5 Hash 1c13614d305a1e3750afb79e4347356b
Repository https://github.com/felixding/LonelyThinker.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/* SVN FILE:  $Id: link.php 42 2009-09-24 12:53:07Z  $ */
/**
 * Short description for file.
 *
 * Long description for file
 *
 * PHP versions 5
 *
 * Licensed under The BSD License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright     Copyright 2007-2009, Felix Ding (http://dingyu.me)
 * @link          http://lonelythinker.org Project LonelyThinker
 * @package       LonelyThinker
 * @author		  $LastChangedBy: $
 * @version       $Revision: 42 $
 * @modifiedby    $LastChangedBy: $
 * @lastmodified  $Date: 2009-09-24 20:53:07 +0800 (Thu, 24 Sep 2009) $
 * @license       http://www.opensource.org/licenses/bsd-license.php The BSD License
 */
class Link extends AppModel
{
    var $name = 'Link';
    var $belongsTo = array('LinkCategory');
	var $validate = array(
		'link_category_id' => array('rule'=>'validCategoryId', 'message'=>'Make sure you enter a valid link category id'),
        'title' => array(
        	'notEmpty'=>array('rule'=>'notEmpty', 'message'=>'You forgot to name a title for the link'),
        	'maxLength'=>array('rule'=>array('maxLength', 100), 'message'=>'What? 100 characters are not enough for the title?!')
        ),
        'url' => array(
        	'notEmpty'=>array('rule'=>'notEmpty', 'message'=>'Make sure you enter a valid URL'),
        	'maxLength'=>array('rule'=>array('maxLength', 255), 'message'=>'What? 255 characters are not enough for the URL?!')
        )
    );
    
    public function validCategoryId($data)
    {
    	$linkCategory = ClassRegistry::init('LinkCategory');
    	return $linkCategory->findById($data);
    }  
}
?>
Back to Top