steak /app/models/link.php

Language PHP Lines 47
MD5 Hash 62490540a080b181a39f284f62333613
Repository https://github.com/ata/steak.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
46
<?php
class Link extends AppModel {

	var $name = 'Link';

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $belongsTo = array(
		'Parentlink' => array(
			'className' => 'Link',
			'foreignKey' => 'parent_id'
		)
	);

	var $hasMany = array(
	    'Childlink' => array(
			'className' => 'Link',
			'foreignKey' => 'parent_id'
		)
    );

	var $hasAndBelongsToMany = array(
		'Group' => array(
			'className' => 'Group',
			'joinTable' => 'groups_links',
			'foreignKey' => 'link_id',
			'associationForeignKey' => 'group_id',
			'unique' => true,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
			'deleteQuery' => '',
			'insertQuery' => ''
		)
	);

	function getMenu($type){
		$conditions = array('Link.parent_id'=>NULL,'Link.is_show'=>1);
		$order = 'Link.position ASC';
		$modules = $this->find('all',array('conditions'=>$conditions,'order'=>$order));
		return $modules;
	}
}
?>
Back to Top