| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 lmb_require('limb/web_app/src/controller/lmbController.class.php'); 10 lmb_require('limb/cms/src/lmbCmsTreeBrowser.class.php'); 11 12 /** 13 * class AdminTreeController. 14 * 15 * @package cms 16 * @version $Id: AdminTreeController.class.php 5945 2007-06-06 08:31:43Z pachanga $ 17 */ 18 class AdminTreeController extends lmbController 19 { 20 function doCreateNode() 21 { 22 $this->useForm('node_form'); 23 $this->setFormDatasource($this->request); 24 25 if($this->request->hasPost()) 26 { 27 $class_name = $this->request->get('class_name') ? $this->request->get('class_name') : 'lmbCmsNode'; 28 $node = new $class_name(); 29 30 $this->_importAndSave($node); 31 } 32 else 33 $this->request->set('class_name', 'lmbCmsNode'); 34 } 35 36 function doEditNode() 37 { 38 $node = lmbActiveRecord :: findById('lmbCmsNode', $this->request->getInteger('id')); 39 $this->useForm('node_form'); 40 $this->setFormDatasource($this->request); 41 42 if($this->request->hasPost()) 43 $this->_importAndSave($node); 44 else 45 { 46 $this->request->merge($node->export()); 47 $this->request->set('controller_name', $node->getControllerName()); 48 } 49 } 50 51 protected function _importAndSave($node) 52 { 53 $node->import($this->request); 54 55 $node->validate($this->error_list); 56 57 if($this->error_list->isValid()) 58 { 59 $node->saveSkipValidation(); 60 $this->closePopup(); 61 } 62 } 63 64 function doDelete() 65 { 66 if($this->request->hasPost() && $this->request->get('delete')) 67 { 68 foreach($this->request->getArray('ids') as $id) 69 { 70 $node = lmbActiveRecord :: findById('lmbCmsNode', $id); 71 $node->destroy(); 72 } 73 $this->closePopup(); 74 } 75 } 76 77 function doSavePriority() 78 { 79 $priority = $this->request->get('priority'); 80 81 if(!is_array($priority) || !sizeof($priority)) 82 throw new lmbException('"priority" request param should be an array!'); 83 84 foreach($priority as $id => $value) 85 { 86 $node = new lmbCmsNode($id); 87 $node->setPriority($value); 88 $node->save(); 89 } 90 91 $this->closePopup(); 92 } 93 94 function doMove() 95 { 96 if($parent_id = $this->request->getInteger('id')) 97 { 98 $parent_node = new lmbCmsNode($parent_id); 99 $this->request->set('parent', $parent_node); 100 } 101 102 $this->useForm('tree_form'); 103 $this->setFormDatasource($this->request); 104 105 if($this->request->hasPost() && $this->request->get('move')) 106 { 107 $parent_id = $this->request->get('parent_id'); 108 foreach($this->request->getArray('ids') as $id) 109 { 110 $node = lmbActiveRecord :: findById('lmbCmsNode', $id); 111 $node->setParentId($parent_id); 112 $node->save(); 113 } 114 $this->closePopup(); 115 } 116 } 117 118 function doProcessCommand() 119 { 120 $resource_type = $this->request->get('Type'); 121 $current_folder = $this->request->get('CurrentFolder'); 122 $command = $this->request->get('Command'); 123 124 $browser = new TreeBrowser(); 125 $browser->setCurrentFolderPath($current_folder); 126 127 $this->_setXmlHeaders(); 128 129 $xml = '<?xml version="1.0" encoding="utf-8" ?>'; 130 $xml .= '<Connector command="' . $command . '" resourceType="' . $resource_type . '">' ; 131 $xml .= '<CurrentFolder path="' . $current_folder . '" url="/" />' ; 132 133 $xml .= '<Folders>' . $browser->renderFolders() . '</Folders>'; 134 $xml .= '<Files></Files>'; 135 136 $xml .= '</Connector>'; 137 138 return $xml; 139 } 140 141 protected function _setXmlHeaders() 142 { 143 $this->response->header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ; 144 $this->response->header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ; 145 $this->response->header('Cache-Control: no-store, no-cache, must-revalidate') ; 146 $this->response->header('Cache-Control: post-check=0, pre-check=0', false) ; 147 $this->response->header('Pragma: no-cache') ; 148 $this->response->header( 'Content-Type:text/xml; charset=utf-8' ) ; 149 } 150 151 } 152 153 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Oct 7 05:02:03 2008 | Cross-referenced by PHPXref 0.7 |