PageRenderTime 40ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/app/models/link.php

https://github.com/ata/steak
PHP | 46 lines | 40 code | 5 blank | 1 comment | 0 complexity | 62490540a080b181a39f284f62333613 MD5 | raw file
  1. <?php
  2. class Link extends AppModel {
  3. var $name = 'Link';
  4. //The Associations below have been created with all possible keys, those that are not needed can be removed
  5. var $belongsTo = array(
  6. 'Parentlink' => array(
  7. 'className' => 'Link',
  8. 'foreignKey' => 'parent_id'
  9. )
  10. );
  11. var $hasMany = array(
  12. 'Childlink' => array(
  13. 'className' => 'Link',
  14. 'foreignKey' => 'parent_id'
  15. )
  16. );
  17. var $hasAndBelongsToMany = array(
  18. 'Group' => array(
  19. 'className' => 'Group',
  20. 'joinTable' => 'groups_links',
  21. 'foreignKey' => 'link_id',
  22. 'associationForeignKey' => 'group_id',
  23. 'unique' => true,
  24. 'conditions' => '',
  25. 'fields' => '',
  26. 'order' => '',
  27. 'limit' => '',
  28. 'offset' => '',
  29. 'finderQuery' => '',
  30. 'deleteQuery' => '',
  31. 'insertQuery' => ''
  32. )
  33. );
  34. function getMenu($type){
  35. $conditions = array('Link.parent_id'=>NULL,'Link.is_show'=>1);
  36. $order = 'Link.position ASC';
  37. $modules = $this->find('all',array('conditions'=>$conditions,'order'=>$order));
  38. return $modules;
  39. }
  40. }
  41. ?>