Skip to content
Browse files

dynamicly load pic for home page and products page imgs are not added…

… to git
  • Loading branch information...
1 parent c6858ec commit d5930c43477cfb67bc5bd5f084a5890d0cd4f612 @s3265176 committed Jul 5, 2013
View
12 app/Plugin/Croogo/View/Elements/footer.ctp
@@ -5,16 +5,16 @@
<hr />
<div class="row">
<div class="large-6 columns">
- <p style="color:#666;">&copy; Copyright no one at all. Go to town.</p>
- <p style="color:#666;">&copy; Copyright no one at all. Go to town.</p>
+ <p style="color:#F78D3F;">&copy; Copyright no one at all. Go to town.</p>
+ <p style="color:#F78D3F;">&copy; Copyright no one at all. Go to town.</p>
</div>
<div class="large-6 columns">
<ul class="inline-list ">
- <li><a href="#">Link 1</a></li>
- <li><a href="#">Link 2</a></li>
- <li><a href="#">Link 3</a></li>
- <li><a href="#">Link 4</a></li>
+ <li><a style="color:#F78D3F;" href="#">Link 1</a></li>
+ <li><a style="color:#F78D3F;" href="#">Link 2</a></li>
+ <li><a style="color:#F78D3F;" href="#">Link 3</a></li>
+ <li><a style="color:#F78D3F;" href="#">Link 4</a></li>
</ul>
</div>
</div>
View
15 app/Plugin/Croogo/webroot/css/theme.css
@@ -24,6 +24,17 @@ div.paging { text-align: center; margin: 30px; }
#wrapper { border-top: 10px solid #444; }
*/
+/**
+*color theam
+*Header(darkyellow) #FCD271
+*title (orange) #F78D3F
+*link(blue) #2BBBD8
+*back(black) #102E37
+*back(grey) #E8EDE0
+*
+*/
+
+
body{
background-image:url('../img/bg1.png');
background-repeat:repeat;
@@ -40,9 +51,9 @@ body{
form .textarea textarea { width: 300px; }
form .error-message { color: #ee4b33; }
- #header {height:150px;background-image: url("../img/footer.png");}
+ #header {height:150px; background-color: #102E37}
#header .site-tagline { color: #666; font-style: italic; font-size: 13px; }
- #header h1 a { text-decoration: none; }
+ #header h1 a { color: #FCD271;text-decoration: none; }
/**
* Header
#header h1 { margin: 50px 0px 10px 0px; }
View
BIN app/Plugin/Croogo/webroot/img/bg1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
24 app/Plugin/Nodes/Config/routes.php
@@ -3,15 +3,15 @@
// Basic
CroogoRouter::connect('/', array(
'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'promoted'
-));
+ ));
CroogoRouter::connect('/promoted/*', array(
'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'promoted'
-));
+ ));
CroogoRouter::connect('/search/*', array(
'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'search'
-));
+ ));
// Content types
CroogoRouter::contentType('blog');
@@ -24,22 +24,30 @@
CroogoRouter::connect('/about', array(
'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'view',
'type' => 'page', 'slug' => 'about'
-));
+ ));
CroogoRouter::connect('/page/:slug', array(
'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'view',
'type' => 'page'
-));
+ ));
//my add on
CroogoRouter::connect('/home', array(
'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'home'
-));
+ ));
CroogoRouter::connect('/news', array(
'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'news'
-));
+ ));
CroogoRouter::connect('/products', array(
'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'products'
-));
+ ));
+
+CroogoRouter::connect('/products/:type', array(
+ 'plugin' => 'nodes', 'controller' => 'nodes', 'action' => 'products'
+ ),
+ array('pass' => 'type')
+);
+
+
View
1,097 app/Plugin/Nodes/Controller/NodesController.php
@@ -23,23 +23,23 @@ class NodesController extends NodesAppController {
* @var string
* @access public
*/
- public $name = 'Nodes';
+public $name = 'Nodes';
/**
* Components
*
* @var array
* @access public
*/
- public $components = array(
- 'Croogo.Recaptcha',
- 'Search.Prg' => array(
- 'presetForm' => array(
- 'paramType' => 'querystring',
+public $components = array(
+ 'Croogo.Recaptcha',
+ 'Search.Prg' => array(
+ 'presetForm' => array(
+ 'paramType' => 'querystring',
),
- 'commonProcess' => array(
- 'paramType' => 'querystring',
- 'filterEmpty' => true,
+ 'commonProcess' => array(
+ 'paramType' => 'querystring',
+ 'filterEmpty' => true,
),
),
);
@@ -50,43 +50,43 @@ class NodesController extends NodesAppController {
* @var array
* @access public
*/
- public $presetVars = true;
+public $presetVars = true;
/**
* Models used by the Controller
*
* @var array
* @access public
*/
- public $uses = array(
- 'Nodes.Node',
+public $uses = array(
+ 'Nodes.Node',
);
/**
* afterConstruct
*/
- public function afterConstruct() {
- parent::afterConstruct();
- $this->_setupAclComponent();
- }
+public function afterConstruct() {
+ parent::afterConstruct();
+ $this->_setupAclComponent();
+}
/**
* beforeFilter
*
* @return void
* @access public
*/
- public function beforeFilter() {
- parent::beforeFilter();
+public function beforeFilter() {
+ parent::beforeFilter();
- if (isset($this->request->params['slug'])) {
- $this->request->params['named']['slug'] = $this->request->params['slug'];
- }
- if (isset($this->request->params['type'])) {
- $this->request->params['named']['type'] = $this->request->params['type'];
- }
- $this->Security->unlockedActions[] = 'admin_toggle';
+ if (isset($this->request->params['slug'])) {
+ $this->request->params['named']['slug'] = $this->request->params['slug'];
+ }
+ if (isset($this->request->params['type'])) {
+ $this->request->params['named']['type'] = $this->request->params['type'];
}
+ $this->Security->unlockedActions[] = 'admin_toggle';
+}
/**
* Toggle Node status
@@ -95,57 +95,57 @@ public function beforeFilter() {
* @param $status integer Current Node status
* @return void
*/
- public function admin_toggle($id = null, $status = null) {
- $this->Croogo->fieldToggle($this->Node, $id, $status);
- }
+public function admin_toggle($id = null, $status = null) {
+ $this->Croogo->fieldToggle($this->Node, $id, $status);
+}
/**
* Admin index
*
* @return void
* @access public
*/
- public function admin_index() {
- $this->set('title_for_layout', __d('croogo', 'Content'));
- $this->Prg->commonProcess();
-
- $this->Node->recursive = 0;
- $this->paginate['Node']['order'] = 'Node.created DESC';
- $this->paginate['Node']['conditions'] = array();
- $this->paginate['Node']['contain'] = array('User');
-
- $types = $this->Node->Taxonomy->Vocabulary->Type->find('all');
- $typeAliases = Hash::extract($types, '{n}.Type.alias');
- $this->paginate['Node']['conditions']['Node.type'] = $typeAliases;
-
- $nodes = $this->paginate($this->Node->parseCriteria($this->request->query));
- $nodeTypes = $this->Node->Taxonomy->Vocabulary->Type->find('list', array(
- 'fields' => array('Type.alias', 'Type.title')
- ));
- $this->set(compact('nodes', 'types', 'typeAliases', 'nodeTypes'));
+public function admin_index() {
+ $this->set('title_for_layout', __d('croogo', 'Content'));
+ $this->Prg->commonProcess();
+
+ $this->Node->recursive = 0;
+ $this->paginate['Node']['order'] = 'Node.created DESC';
+ $this->paginate['Node']['conditions'] = array();
+ $this->paginate['Node']['contain'] = array('User');
+
+ $types = $this->Node->Taxonomy->Vocabulary->Type->find('all');
+ $typeAliases = Hash::extract($types, '{n}.Type.alias');
+ $this->paginate['Node']['conditions']['Node.type'] = $typeAliases;
+
+ $nodes = $this->paginate($this->Node->parseCriteria($this->request->query));
+ $nodeTypes = $this->Node->Taxonomy->Vocabulary->Type->find('list', array(
+ 'fields' => array('Type.alias', 'Type.title')
+ ));
+ $this->set(compact('nodes', 'types', 'typeAliases', 'nodeTypes'));
- if (isset($this->request->params['named']['links']) || isset($this->request->query['chooser'])) {
- $this->layout = 'admin_popup';
- $this->render('admin_chooser');
- }
+ if (isset($this->request->params['named']['links']) || isset($this->request->query['chooser'])) {
+ $this->layout = 'admin_popup';
+ $this->render('admin_chooser');
}
+}
/**
* Admin create
*
* @return void
* @access public
*/
- public function admin_create() {
- $this->set('title_for_layout', __d('croogo', 'Create content'));
+public function admin_create() {
+ $this->set('title_for_layout', __d('croogo', 'Create content'));
- $types = $this->Node->Taxonomy->Vocabulary->Type->find('all', array(
- 'order' => array(
- 'Type.alias' => 'ASC',
+ $types = $this->Node->Taxonomy->Vocabulary->Type->find('all', array(
+ 'order' => array(
+ 'Type.alias' => 'ASC',
),
));
- $this->set(compact('types'));
- }
+ $this->set(compact('types'));
+}
/**
* Admin add
@@ -154,39 +154,39 @@ public function admin_create() {
* @return void
* @access public
*/
- public function admin_add($typeAlias = 'node') {
- $type = $this->Node->Taxonomy->Vocabulary->Type->findByAlias($typeAlias);
- if (!isset($type['Type']['alias'])) {
- $this->Session->setFlash(__d('croogo', 'Content type does not exist.'));
- $this->redirect(array('action' => 'create'));
- }
+public function admin_add($typeAlias = 'node') {
+ $type = $this->Node->Taxonomy->Vocabulary->Type->findByAlias($typeAlias);
+ if (!isset($type['Type']['alias'])) {
+ $this->Session->setFlash(__d('croogo', 'Content type does not exist.'));
+ $this->redirect(array('action' => 'create'));
+ }
- if (!empty($this->request->data)) {
- if (isset($this->request->data[$this->Node->alias]['type'])) {
- $typeAlias = $this->request->data['Node']['type'];
- $this->Node->type = $typeAlias;
- }
- if ($this->Node->saveNode($this->request->data, $typeAlias)) {
- Croogo::dispatchEvent('Controller.Nodes.afterAdd', $this, array('data' => $this->request->data));
- $this->Session->setFlash(__d('croogo', '%s has been saved', $type['Type']['title']), 'default', array('class' => 'success'));
- $this->Croogo->redirect(array('action' => 'edit', $this->Node->id));
- } else {
- $this->Session->setFlash(__d('croogo', '%s could not be saved. Please, try again.', $type['Type']['title']), 'default', array('class' => 'error'));
- }
+ if (!empty($this->request->data)) {
+ if (isset($this->request->data[$this->Node->alias]['type'])) {
+ $typeAlias = $this->request->data['Node']['type'];
+ $this->Node->type = $typeAlias;
+ }
+ if ($this->Node->saveNode($this->request->data, $typeAlias)) {
+ Croogo::dispatchEvent('Controller.Nodes.afterAdd', $this, array('data' => $this->request->data));
+ $this->Session->setFlash(__d('croogo', '%s has been saved', $type['Type']['title']), 'default', array('class' => 'success'));
+ $this->Croogo->redirect(array('action' => 'edit', $this->Node->id));
} else {
- $this->request->data['Node']['user_id'] = $this->Session->read('Auth.User.id');
+ $this->Session->setFlash(__d('croogo', '%s could not be saved. Please, try again.', $type['Type']['title']), 'default', array('class' => 'error'));
+ }
+ } else {
+ $this->request->data['Node']['user_id'] = $this->Session->read('Auth.User.id');
- $this->set('title_for_layout', __d('croogo', 'Create content: %s', $type['Type']['title']));
- $this->Node->type = $type['Type']['alias'];
- $this->Node->Behaviors->attach('Tree', array(
- 'scope' => array(
- 'Node.type' => $this->Node->type,
+ $this->set('title_for_layout', __d('croogo', 'Create content: %s', $type['Type']['title']));
+ $this->Node->type = $type['Type']['alias'];
+ $this->Node->Behaviors->attach('Tree', array(
+ 'scope' => array(
+ 'Node.type' => $this->Node->type,
),
));
- $this->_setCommonVariables($type);
- }
+ $this->_setCommonVariables($type);
}
+}
/**
* Admin edit
@@ -195,70 +195,70 @@ public function admin_add($typeAlias = 'node') {
* @return void
* @access public
*/
- public function admin_edit($id = null) {
- if (!$id && empty($this->request->data)) {
- $this->Session->setFlash(__d('croogo', 'Invalid content'), 'default', array('class' => 'error'));
- $this->redirect(array('action' => 'index'));
- }
- $this->Node->id = $id;
- $typeAlias = $this->Node->field('type');
- $type = $this->Node->Taxonomy->Vocabulary->Type->findByAlias($typeAlias);
-
- if (!empty($this->request->data)) {
- if ($this->Node->saveNode($this->request->data, $typeAlias)) {
- Croogo::dispatchEvent('Controller.Nodes.afterEdit', $this, compact('data'));
- $this->Session->setFlash(__d('croogo', '%s has been saved', $type['Type']['title']), 'default', array('class' => 'success'));
- $this->Croogo->redirect(array('action' => 'edit', $this->Node->id));
- } else {
- $this->Session->setFlash(__d('croogo', '%s could not be saved. Please, try again.', $type['Type']['title']), 'default', array('class' => 'error'));
- }
- }
- if (empty($this->request->data)) {
- $data = $this->Node->read(null, $id);
- $data['Role']['Role'] = $this->Node->decodeData($data['Node']['visibility_roles']);
- $this->request->data = $data;
+public function admin_edit($id = null) {
+ if (!$id && empty($this->request->data)) {
+ $this->Session->setFlash(__d('croogo', 'Invalid content'), 'default', array('class' => 'error'));
+ $this->redirect(array('action' => 'index'));
+ }
+ $this->Node->id = $id;
+ $typeAlias = $this->Node->field('type');
+ $type = $this->Node->Taxonomy->Vocabulary->Type->findByAlias($typeAlias);
+
+ if (!empty($this->request->data)) {
+ if ($this->Node->saveNode($this->request->data, $typeAlias)) {
+ Croogo::dispatchEvent('Controller.Nodes.afterEdit', $this, compact('data'));
+ $this->Session->setFlash(__d('croogo', '%s has been saved', $type['Type']['title']), 'default', array('class' => 'success'));
+ $this->Croogo->redirect(array('action' => 'edit', $this->Node->id));
+ } else {
+ $this->Session->setFlash(__d('croogo', '%s could not be saved. Please, try again.', $type['Type']['title']), 'default', array('class' => 'error'));
}
-
- $this->set('title_for_layout', __d('croogo', 'Edit %s: %s', $type['Type']['title'], $this->request->data['Node']['title']));
- $this->_setCommonVariables($type);
}
+ if (empty($this->request->data)) {
+ $data = $this->Node->read(null, $id);
+ $data['Role']['Role'] = $this->Node->decodeData($data['Node']['visibility_roles']);
+ $this->request->data = $data;
+ }
+
+ $this->set('title_for_layout', __d('croogo', 'Edit %s: %s', $type['Type']['title'], $this->request->data['Node']['title']));
+ $this->_setCommonVariables($type);
+}
/**
* Admin update paths
*
* @return void
* @access public
*/
- public function admin_update_paths() {
- if ($this->Node->updateAllNodesPaths()) {
- $messageFlash = __d('croogo', 'Paths updated.');
- $class = 'success';
- } else {
- $messageFlash = __d('croogo', 'Something went wrong while updating paths.' . "\n" . 'Please try again');
- $class = 'error';
- }
-
- $this->Session->setFlash($messageFlash, 'default', compact('class'));
- $this->redirect(array('action' => 'index'));
+public function admin_update_paths() {
+ if ($this->Node->updateAllNodesPaths()) {
+ $messageFlash = __d('croogo', 'Paths updated.');
+ $class = 'success';
+ } else {
+ $messageFlash = __d('croogo', 'Something went wrong while updating paths.' . "\n" . 'Please try again');
+ $class = 'error';
}
+ $this->Session->setFlash($messageFlash, 'default', compact('class'));
+ $this->redirect(array('action' => 'index'));
+}
+
/**
* Admin delete
*
* @param integer $id
* @return void
* @access public
*/
- public function admin_delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__d('croogo', 'Invalid id for Node'), 'default', array('class' => 'error'));
- $this->redirect(array('action' => 'index'));
- }
- if ($this->Node->delete($id)) {
- $this->Session->setFlash(__d('croogo', 'Node deleted'), 'default', array('class' => 'success'));
- $this->redirect(array('action' => 'index'));
- }
+public function admin_delete($id = null) {
+ if (!$id) {
+ $this->Session->setFlash(__d('croogo', 'Invalid id for Node'), 'default', array('class' => 'error'));
+ $this->redirect(array('action' => 'index'));
+ }
+ if ($this->Node->delete($id)) {
+ $this->Session->setFlash(__d('croogo', 'Node deleted'), 'default', array('class' => 'success'));
+ $this->redirect(array('action' => 'index'));
}
+}
/**
* Admin delete meta
@@ -267,305 +267,305 @@ public function admin_delete($id = null) {
* @return void
* @access public
*/
- public function admin_delete_meta($id = null) {
- $success = false;
- if ($id != null && $this->Node->Meta->delete($id)) {
+public function admin_delete_meta($id = null) {
+ $success = false;
+ if ($id != null && $this->Node->Meta->delete($id)) {
+ $success = true;
+ } else {
+ if (!$this->Node->Meta->exists($id)) {
$success = true;
- } else {
- if (!$this->Node->Meta->exists($id)) {
- $success = true;
- }
}
-
- $this->set(compact('success'));
}
+ $this->set(compact('success'));
+}
+
/**
* Admin add meta
*
* @return void
* @access public
*/
- public function admin_add_meta() {
- $this->layout = 'ajax';
- }
+public function admin_add_meta() {
+ $this->layout = 'ajax';
+}
/**
* Admin process
*
* @return void
* @access public
*/
- public function admin_process() {
- $action = $this->request->data['Node']['action'];
- $ids = array();
- foreach ($this->request->data['Node'] as $id => $value) {
- if ($id != 'action' && $value['id'] == 1) {
- $ids[] = $id;
- }
- }
-
- if (count($ids) == 0 || $action == null) {
- $this->Session->setFlash(__d('croogo', 'No items selected.'), 'default', array('class' => 'error'));
- $this->redirect(array('action' => 'index'));
- }
-
- $actionProcessed = $this->Node->processAction($action, $ids);
- $eventName = 'Controller.Nodes.after' . ucfirst($action);
-
- if ($actionProcessed) {
- switch ($action) {
- case 'delete':
- $messageFlash = __d('croogo', 'Nodes deleted');
- break;
- case 'publish':
- $messageFlash = __d('croogo', 'Nodes published');
- break;
- case 'unpublish':
- $messageFlash = __d('croogo', 'Nodes unpublished');
- break;
- case 'promote':
- $messageFlash = __d('croogo', 'Nodes promoted');
- break;
- case 'unpromote':
- $messageFlash = __d('croogo', 'Nodes unpromoted');
- break;
- }
- $this->Session->setFlash($messageFlash, 'default', array('class' => 'success'));
- Croogo::dispatchEvent($eventName, $this, compact($ids));
- } else {
- $this->Session->setFlash(__d('croogo', 'An error occurred.'), 'default', array('class' => 'error'));
+public function admin_process() {
+ $action = $this->request->data['Node']['action'];
+ $ids = array();
+ foreach ($this->request->data['Node'] as $id => $value) {
+ if ($id != 'action' && $value['id'] == 1) {
+ $ids[] = $id;
}
+ }
+ if (count($ids) == 0 || $action == null) {
+ $this->Session->setFlash(__d('croogo', 'No items selected.'), 'default', array('class' => 'error'));
$this->redirect(array('action' => 'index'));
}
+ $actionProcessed = $this->Node->processAction($action, $ids);
+ $eventName = 'Controller.Nodes.after' . ucfirst($action);
+
+ if ($actionProcessed) {
+ switch ($action) {
+ case 'delete':
+ $messageFlash = __d('croogo', 'Nodes deleted');
+ break;
+ case 'publish':
+ $messageFlash = __d('croogo', 'Nodes published');
+ break;
+ case 'unpublish':
+ $messageFlash = __d('croogo', 'Nodes unpublished');
+ break;
+ case 'promote':
+ $messageFlash = __d('croogo', 'Nodes promoted');
+ break;
+ case 'unpromote':
+ $messageFlash = __d('croogo', 'Nodes unpromoted');
+ break;
+ }
+ $this->Session->setFlash($messageFlash, 'default', array('class' => 'success'));
+ Croogo::dispatchEvent($eventName, $this, compact($ids));
+ } else {
+ $this->Session->setFlash(__d('croogo', 'An error occurred.'), 'default', array('class' => 'error'));
+ }
+
+ $this->redirect(array('action' => 'index'));
+}
+
/**
* Index
*
* @return void
* @access public
*/
- public function index() {
- if (!isset($this->request->params['named']['type'])) {
- $this->request->params['named']['type'] = 'node';
- }
+public function index() {
+ if (!isset($this->request->params['named']['type'])) {
+ $this->request->params['named']['type'] = 'node';
+ }
- $this->paginate['Node']['order'] = 'Node.created DESC';
- $this->paginate['Node']['limit'] = Configure::read('Reading.nodes_per_page');
- $this->paginate['Node']['conditions'] = array(
- 'Node.status' => 1,
- 'OR' => array(
- 'Node.visibility_roles' => '',
- 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
+ $this->paginate['Node']['order'] = 'Node.created DESC';
+ $this->paginate['Node']['limit'] = Configure::read('Reading.nodes_per_page');
+ $this->paginate['Node']['conditions'] = array(
+ 'Node.status' => 1,
+ 'OR' => array(
+ 'Node.visibility_roles' => '',
+ 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
),
);
- $this->paginate['Node']['contain'] = array(
- 'Meta',
- 'Taxonomy' => array(
- 'Term',
- 'Vocabulary',
+ $this->paginate['Node']['contain'] = array(
+ 'Meta',
+ 'Taxonomy' => array(
+ 'Term',
+ 'Vocabulary',
),
- 'User',
+ 'User',
);
- if (isset($this->request->params['named']['type'])) {
- $type = $this->Node->Taxonomy->Vocabulary->Type->find('first', array(
- 'conditions' => array(
- 'Type.alias' => $this->request->params['named']['type'],
+ if (isset($this->request->params['named']['type'])) {
+ $type = $this->Node->Taxonomy->Vocabulary->Type->find('first', array(
+ 'conditions' => array(
+ 'Type.alias' => $this->request->params['named']['type'],
),
- 'cache' => array(
- 'name' => 'type_' . $this->request->params['named']['type'],
- 'config' => 'nodes_index',
+ 'cache' => array(
+ 'name' => 'type_' . $this->request->params['named']['type'],
+ 'config' => 'nodes_index',
),
));
- if (!isset($type['Type']['id'])) {
- $this->Session->setFlash(__d('croogo', 'Invalid content type.'), 'default', array('class' => 'error'));
- $this->redirect('/');
- }
- if (isset($type['Params']['nodes_per_page'])) {
- $this->paginate['Node']['limit'] = $type['Params']['nodes_per_page'];
- }
- $this->paginate['Node']['conditions']['Node.type'] = $type['Type']['alias'];
- $this->set('title_for_layout', $type['Type']['title']);
+ if (!isset($type['Type']['id'])) {
+ $this->Session->setFlash(__d('croogo', 'Invalid content type.'), 'default', array('class' => 'error'));
+ $this->redirect('/');
}
+ if (isset($type['Params']['nodes_per_page'])) {
+ $this->paginate['Node']['limit'] = $type['Params']['nodes_per_page'];
+ }
+ $this->paginate['Node']['conditions']['Node.type'] = $type['Type']['alias'];
+ $this->set('title_for_layout', $type['Type']['title']);
+ }
- if ($this->usePaginationCache) {
- $cacheNamePrefix = 'nodes_index_' . $this->Croogo->roleId . '_' . Configure::read('Config.language');
- if (isset($type)) {
- $cacheNamePrefix .= '_' . $type['Type']['alias'];
- }
- $this->paginate['page'] = isset($this->request->params['named']['page']) ? $this->params['named']['page'] : 1;
- $cacheName = $cacheNamePrefix . '_' . $this->request->params['named']['type'] . '_' . $this->paginate['page'] . '_' . $this->paginate['Node']['limit'];
- $cacheNamePaging = $cacheNamePrefix . '_' . $this->request->params['named']['type'] . '_' . $this->paginate['page'] . '_' . $this->paginate['Node']['limit'] . '_paging';
- $cacheConfig = 'nodes_index';
- $nodes = Cache::read($cacheName, $cacheConfig);
- if (!$nodes) {
- $nodes = $this->paginate('Node');
- Cache::write($cacheName, $nodes, $cacheConfig);
- Cache::write($cacheNamePaging, $this->request->params['paging'], $cacheConfig);
- } else {
- $paging = Cache::read($cacheNamePaging, $cacheConfig);
- $this->request->params['paging'] = $paging;
- }
- } else {
+ if ($this->usePaginationCache) {
+ $cacheNamePrefix = 'nodes_index_' . $this->Croogo->roleId . '_' . Configure::read('Config.language');
+ if (isset($type)) {
+ $cacheNamePrefix .= '_' . $type['Type']['alias'];
+ }
+ $this->paginate['page'] = isset($this->request->params['named']['page']) ? $this->params['named']['page'] : 1;
+ $cacheName = $cacheNamePrefix . '_' . $this->request->params['named']['type'] . '_' . $this->paginate['page'] . '_' . $this->paginate['Node']['limit'];
+ $cacheNamePaging = $cacheNamePrefix . '_' . $this->request->params['named']['type'] . '_' . $this->paginate['page'] . '_' . $this->paginate['Node']['limit'] . '_paging';
+ $cacheConfig = 'nodes_index';
+ $nodes = Cache::read($cacheName, $cacheConfig);
+ if (!$nodes) {
$nodes = $this->paginate('Node');
+ Cache::write($cacheName, $nodes, $cacheConfig);
+ Cache::write($cacheNamePaging, $this->request->params['paging'], $cacheConfig);
+ } else {
+ $paging = Cache::read($cacheNamePaging, $cacheConfig);
+ $this->request->params['paging'] = $paging;
}
+ } else {
+ $nodes = $this->paginate('Node');
+ }
- $this->set(compact('type', 'nodes'));
- $this->_viewFallback(array(
- 'index_' . $type['Type']['alias'],
+ $this->set(compact('type', 'nodes'));
+ $this->_viewFallback(array(
+ 'index_' . $type['Type']['alias'],
));
- }
+}
/**
* Term
*
* @return void
* @access public
*/
- public function term() {
- $this->layout = 'foundation_news';
- $term = $this->Node->Taxonomy->Term->find('first', array(
- 'conditions' => array(
- 'Term.slug' => $this->request->params['named']['slug'],
+public function term() {
+ $this->layout = 'foundation_news';
+ $term = $this->Node->Taxonomy->Term->find('first', array(
+ 'conditions' => array(
+ 'Term.slug' => $this->request->params['named']['slug'],
),
- 'cache' => array(
- 'name' => 'term_' . $this->request->params['named']['slug'],
- 'config' => 'nodes_term',
+ 'cache' => array(
+ 'name' => 'term_' . $this->request->params['named']['slug'],
+ 'config' => 'nodes_term',
),
));
- if (!isset($term['Term']['id'])) {
- $this->Session->setFlash(__d('croogo', 'Invalid Term.'), 'default', array('class' => 'error'));
- $this->redirect('/');
- }
+ if (!isset($term['Term']['id'])) {
+ $this->Session->setFlash(__d('croogo', 'Invalid Term.'), 'default', array('class' => 'error'));
+ $this->redirect('/');
+ }
- if (!isset($this->request->params['named']['type'])) {
- $this->request->params['named']['type'] = 'node';
- }
+ if (!isset($this->request->params['named']['type'])) {
+ $this->request->params['named']['type'] = 'node';
+ }
- $this->paginate['Node']['order'] = 'Node.created DESC';
- $this->paginate['Node']['limit'] = Configure::read('Reading.nodes_per_page');
- $this->paginate['Node']['conditions'] = array(
- 'Node.status' => 1,
- 'Node.terms LIKE' => '%"' . $this->request->params['named']['slug'] . '"%',
- 'OR' => array(
- 'Node.visibility_roles' => '',
- 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
+ $this->paginate['Node']['order'] = 'Node.created DESC';
+ $this->paginate['Node']['limit'] = Configure::read('Reading.nodes_per_page');
+ $this->paginate['Node']['conditions'] = array(
+ 'Node.status' => 1,
+ 'Node.terms LIKE' => '%"' . $this->request->params['named']['slug'] . '"%',
+ 'OR' => array(
+ 'Node.visibility_roles' => '',
+ 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
),
);
- $this->paginate['Node']['contain'] = array(
- 'Meta',
- 'Taxonomy' => array(
- 'Term',
- 'Vocabulary',
+ $this->paginate['Node']['contain'] = array(
+ 'Meta',
+ 'Taxonomy' => array(
+ 'Term',
+ 'Vocabulary',
),
- 'User',
+ 'User',
);
- if (isset($this->request->params['named']['type'])) {
- $type = $this->Node->Taxonomy->Vocabulary->Type->find('first', array(
- 'conditions' => array(
- 'Type.alias' => $this->request->params['named']['type'],
+ if (isset($this->request->params['named']['type'])) {
+ $type = $this->Node->Taxonomy->Vocabulary->Type->find('first', array(
+ 'conditions' => array(
+ 'Type.alias' => $this->request->params['named']['type'],
),
- 'cache' => array(
- 'name' => 'type_' . $this->request->params['named']['type'],
- 'config' => 'nodes_term',
+ 'cache' => array(
+ 'name' => 'type_' . $this->request->params['named']['type'],
+ 'config' => 'nodes_term',
),
));
- if (!isset($type['Type']['id'])) {
- $this->Session->setFlash(__d('croogo', 'Invalid content type.'), 'default', array('class' => 'error'));
- $this->redirect('/');
- }
- if (isset($type['Params']['nodes_per_page'])) {
- $this->paginate['Node']['limit'] = $type['Params']['nodes_per_page'];
- }
- $this->paginate['Node']['conditions']['Node.type'] = $type['Type']['alias'];
- $this->set('title_for_layout', $term['Term']['title']);
+ if (!isset($type['Type']['id'])) {
+ $this->Session->setFlash(__d('croogo', 'Invalid content type.'), 'default', array('class' => 'error'));
+ $this->redirect('/');
+ }
+ if (isset($type['Params']['nodes_per_page'])) {
+ $this->paginate['Node']['limit'] = $type['Params']['nodes_per_page'];
}
+ $this->paginate['Node']['conditions']['Node.type'] = $type['Type']['alias'];
+ $this->set('title_for_layout', $term['Term']['title']);
+ }
- if ($this->usePaginationCache) {
- $cacheNamePrefix = 'nodes_term_' . $this->Croogo->roleId . '_' . $this->request->params['named']['slug'] . '_' . Configure::read('Config.language');
- if (isset($type)) {
- $cacheNamePrefix .= '_' . $type['Type']['alias'];
- }
- $this->paginate['page'] = isset($this->request->params['named']['page']) ? $this->params['named']['page'] : 1;
- $cacheName = $cacheNamePrefix . '_' . $this->paginate['page'] . '_' . $this->paginate['Node']['limit'];
- $cacheNamePaging = $cacheNamePrefix . '_' . $this->paginate['page'] . '_' . $this->paginate['Node']['limit'] . '_paging';
- $cacheConfig = 'nodes_term';
- $nodes = Cache::read($cacheName, $cacheConfig);
- if (!$nodes) {
- $nodes = $this->paginate('Node');
- Cache::write($cacheName, $nodes, $cacheConfig);
- Cache::write($cacheNamePaging, $this->request->params['paging'], $cacheConfig);
- } else {
- $paging = Cache::read($cacheNamePaging, $cacheConfig);
- $this->request->params['paging'] = $paging;
- }
- } else {
+ if ($this->usePaginationCache) {
+ $cacheNamePrefix = 'nodes_term_' . $this->Croogo->roleId . '_' . $this->request->params['named']['slug'] . '_' . Configure::read('Config.language');
+ if (isset($type)) {
+ $cacheNamePrefix .= '_' . $type['Type']['alias'];
+ }
+ $this->paginate['page'] = isset($this->request->params['named']['page']) ? $this->params['named']['page'] : 1;
+ $cacheName = $cacheNamePrefix . '_' . $this->paginate['page'] . '_' . $this->paginate['Node']['limit'];
+ $cacheNamePaging = $cacheNamePrefix . '_' . $this->paginate['page'] . '_' . $this->paginate['Node']['limit'] . '_paging';
+ $cacheConfig = 'nodes_term';
+ $nodes = Cache::read($cacheName, $cacheConfig);
+ if (!$nodes) {
$nodes = $this->paginate('Node');
+ Cache::write($cacheName, $nodes, $cacheConfig);
+ Cache::write($cacheNamePaging, $this->request->params['paging'], $cacheConfig);
+ } else {
+ $paging = Cache::read($cacheNamePaging, $cacheConfig);
+ $this->request->params['paging'] = $paging;
}
+ } else {
+ $nodes = $this->paginate('Node');
+ }
- $this->set(compact('term', 'type', 'nodes'));
- $this->_viewFallback(array(
- 'term_' . $term['Term']['id'],
- 'term_' . $type['Type']['alias'],
+ $this->set(compact('term', 'type', 'nodes'));
+ $this->_viewFallback(array(
+ 'term_' . $term['Term']['id'],
+ 'term_' . $type['Type']['alias'],
));
- }
+}
/**
* Promoted
*
* @return void
* @access public
*/
- public function promoted() {
- $this->set('title_for_layout', __d('croogo', 'Nodes'));
-
- $this->paginate['Node']['type'] = 'promoted';
- $this->paginate['Node']['conditions'] = array(
- 'OR' => array(
- 'Node.visibility_roles' => '',
- 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
+public function promoted() {
+ $this->set('title_for_layout', __d('croogo', 'Nodes'));
+
+ $this->paginate['Node']['type'] = 'promoted';
+ $this->paginate['Node']['conditions'] = array(
+ 'OR' => array(
+ 'Node.visibility_roles' => '',
+ 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
),
);
- if (isset($this->request->params['named']['type'])) {
- $type = $this->Node->Taxonomy->Vocabulary->Type->findByAlias($this->request->params['named']['type']);
- if (!isset($type['Type']['id'])) {
- $this->Session->setFlash(__d('croogo', 'Invalid content type.'), 'default', array('class' => 'error'));
- $this->redirect('/');
- }
- if (isset($type['Params']['nodes_per_page'])) {
- $this->paginate['Node']['limit'] = $type['Params']['nodes_per_page'];
- }
- $this->paginate['Node']['conditions']['Node.type'] = $type['Type']['alias'];
- $this->set('title_for_layout', $type['Type']['title']);
- $this->set(compact('type'));
+ if (isset($this->request->params['named']['type'])) {
+ $type = $this->Node->Taxonomy->Vocabulary->Type->findByAlias($this->request->params['named']['type']);
+ if (!isset($type['Type']['id'])) {
+ $this->Session->setFlash(__d('croogo', 'Invalid content type.'), 'default', array('class' => 'error'));
+ $this->redirect('/');
}
+ if (isset($type['Params']['nodes_per_page'])) {
+ $this->paginate['Node']['limit'] = $type['Params']['nodes_per_page'];
+ }
+ $this->paginate['Node']['conditions']['Node.type'] = $type['Type']['alias'];
+ $this->set('title_for_layout', $type['Type']['title']);
+ $this->set(compact('type'));
+ }
- if ($this->usePaginationCache) {
- $limit = !empty($this->paginate['Node']['limit']) ? $this->paginate['Node']['limit'] : Configure::read('Reading.nodes_per_page');
- $cacheNamePrefix = 'nodes_promoted_' . $this->Croogo->roleId . '_' . Configure::read('Config.language');
- if (isset($type)) {
- $cacheNamePrefix .= '_' . $type['Type']['alias'];
- }
- $this->paginate['page'] = isset($this->request->params['named']['page']) ? $this->params['named']['page'] : 1;
- $cacheName = $cacheNamePrefix . '_' . $this->paginate['page'] . '_' . $limit;
- $cacheNamePaging = $cacheNamePrefix . '_' . $this->paginate['page'] . '_' . $limit . '_paging';
- $cacheConfig = 'nodes_promoted';
- $nodes = Cache::read($cacheName, $cacheConfig);
- if (!$nodes) {
- $nodes = $this->paginate('Node');
- Cache::write($cacheName, $nodes, $cacheConfig);
- Cache::write($cacheNamePaging, $this->request->params['paging'], $cacheConfig);
- } else {
- $paging = Cache::read($cacheNamePaging, $cacheConfig);
- $this->request->params['paging'] = $paging;
- }
- } else {
+ if ($this->usePaginationCache) {
+ $limit = !empty($this->paginate['Node']['limit']) ? $this->paginate['Node']['limit'] : Configure::read('Reading.nodes_per_page');
+ $cacheNamePrefix = 'nodes_promoted_' . $this->Croogo->roleId . '_' . Configure::read('Config.language');
+ if (isset($type)) {
+ $cacheNamePrefix .= '_' . $type['Type']['alias'];
+ }
+ $this->paginate['page'] = isset($this->request->params['named']['page']) ? $this->params['named']['page'] : 1;
+ $cacheName = $cacheNamePrefix . '_' . $this->paginate['page'] . '_' . $limit;
+ $cacheNamePaging = $cacheNamePrefix . '_' . $this->paginate['page'] . '_' . $limit . '_paging';
+ $cacheConfig = 'nodes_promoted';
+ $nodes = Cache::read($cacheName, $cacheConfig);
+ if (!$nodes) {
$nodes = $this->paginate('Node');
+ Cache::write($cacheName, $nodes, $cacheConfig);
+ Cache::write($cacheNamePaging, $this->request->params['paging'], $cacheConfig);
+ } else {
+ $paging = Cache::read($cacheNamePaging, $cacheConfig);
+ $this->request->params['paging'] = $paging;
}
- $this->set(compact('nodes'));
+ } else {
+ $nodes = $this->paginate('Node');
}
+ $this->set(compact('nodes'));
+}
/**
* Search
@@ -574,64 +574,64 @@ public function promoted() {
* @return void
* @access public
*/
- public function search($typeAlias = null) {
- $this->layout = 'foundation_news';
- if (!isset($this->request->params['named']['q'])) {
- $this->redirect('/');
- }
+public function search($typeAlias = null) {
+ $this->layout = 'foundation_news';
+ if (!isset($this->request->params['named']['q'])) {
+ $this->redirect('/');
+ }
- App::uses('Sanitize', 'Utility');
- $q = Sanitize::clean($this->request->params['named']['q']);
- $this->paginate['Node']['order'] = 'Node.created DESC';
- $this->paginate['Node']['limit'] = Configure::read('Reading.nodes_per_page');
- $this->paginate['Node']['conditions'] = array(
- 'Node.status' => 1,
- 'AND' => array(
- array(
- 'OR' => array(
- 'Node.title LIKE' => '%' . $q . '%',
- 'Node.excerpt LIKE' => '%' . $q . '%',
- 'Node.body LIKE' => '%' . $q . '%',
- 'Node.terms LIKE' => '%"' . $q . '"%',
+ App::uses('Sanitize', 'Utility');
+ $q = Sanitize::clean($this->request->params['named']['q']);
+ $this->paginate['Node']['order'] = 'Node.created DESC';
+ $this->paginate['Node']['limit'] = Configure::read('Reading.nodes_per_page');
+ $this->paginate['Node']['conditions'] = array(
+ 'Node.status' => 1,
+ 'AND' => array(
+ array(
+ 'OR' => array(
+ 'Node.title LIKE' => '%' . $q . '%',
+ 'Node.excerpt LIKE' => '%' . $q . '%',
+ 'Node.body LIKE' => '%' . $q . '%',
+ 'Node.terms LIKE' => '%"' . $q . '"%',
),
),
- array(
- 'OR' => array(
- 'Node.visibility_roles' => '',
- 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
+ array(
+ 'OR' => array(
+ 'Node.visibility_roles' => '',
+ 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
),
),
),
);
- $this->paginate['Node']['contain'] = array(
- 'Meta',
- 'Taxonomy' => array(
- 'Term',
- 'Vocabulary',
+ $this->paginate['Node']['contain'] = array(
+ 'Meta',
+ 'Taxonomy' => array(
+ 'Term',
+ 'Vocabulary',
),
- 'User',
+ 'User',
);
- if ($typeAlias) {
- $type = $this->Node->Taxonomy->Vocabulary->Type->findByAlias($typeAlias);
- if (!isset($type['Type']['id'])) {
- $this->Session->setFlash(__d('croogo', 'Invalid content type.'), 'default', array('class' => 'error'));
- $this->redirect('/');
- }
- if (isset($type['Params']['nodes_per_page'])) {
- $this->paginate['Node']['limit'] = $type['Params']['nodes_per_page'];
- }
- $this->paginate['Node']['conditions']['Node.type'] = $typeAlias;
+ if ($typeAlias) {
+ $type = $this->Node->Taxonomy->Vocabulary->Type->findByAlias($typeAlias);
+ if (!isset($type['Type']['id'])) {
+ $this->Session->setFlash(__d('croogo', 'Invalid content type.'), 'default', array('class' => 'error'));
+ $this->redirect('/');
+ }
+ if (isset($type['Params']['nodes_per_page'])) {
+ $this->paginate['Node']['limit'] = $type['Params']['nodes_per_page'];
}
+ $this->paginate['Node']['conditions']['Node.type'] = $typeAlias;
+ }
- $nodes = $this->paginate('Node');
- $this->set('title_for_layout', __d('croogo', 'Search Results: %s', $q));
- $this->set(compact('q', 'nodes'));
- if ($typeAlias) {
- $this->_viewFallback(array(
- 'search_' . $typeAlias,
+ $nodes = $this->paginate('Node');
+ $this->set('title_for_layout', __d('croogo', 'Search Results: %s', $q));
+ $this->set(compact('q', 'nodes'));
+ if ($typeAlias) {
+ $this->_viewFallback(array(
+ 'search_' . $typeAlias,
));
- }
}
+}
/**
* View
@@ -640,110 +640,110 @@ public function search($typeAlias = null) {
* @return void
* @access public
*/
- public function view($id = null) {
- $this->layout = 'foundation_news';
- if (isset($this->request->params['named']['slug']) && isset($this->params['named']['type'])) {
- $this->Node->type = $this->request->params['named']['type'];
- $type = $this->Node->Taxonomy->Vocabulary->Type->find('first', array(
- 'conditions' => array(
- 'Type.alias' => $this->Node->type,
+public function view($id = null) {
+ $this->layout = 'foundation_news';
+ if (isset($this->request->params['named']['slug']) && isset($this->params['named']['type'])) {
+ $this->Node->type = $this->request->params['named']['type'];
+ $type = $this->Node->Taxonomy->Vocabulary->Type->find('first', array(
+ 'conditions' => array(
+ 'Type.alias' => $this->Node->type,
),
- 'cache' => array(
- 'name' => 'type_' . $this->Node->type,
- 'config' => 'nodes_view',
+ 'cache' => array(
+ 'name' => 'type_' . $this->Node->type,
+ 'config' => 'nodes_view',
),
));
- $node = $this->Node->find('first', array(
- 'conditions' => array(
- 'Node.slug' => $this->request->params['named']['slug'],
- 'Node.type' => $this->request->params['named']['type'],
- 'Node.status' => 1,
- 'OR' => array(
- 'Node.visibility_roles' => '',
- 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
+ $node = $this->Node->find('first', array(
+ 'conditions' => array(
+ 'Node.slug' => $this->request->params['named']['slug'],
+ 'Node.type' => $this->request->params['named']['type'],
+ 'Node.status' => 1,
+ 'OR' => array(
+ 'Node.visibility_roles' => '',
+ 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
),
),
- 'contain' => array(
- 'Meta',
- 'Taxonomy' => array(
- 'Term',
- 'Vocabulary',
+ 'contain' => array(
+ 'Meta',
+ 'Taxonomy' => array(
+ 'Term',
+ 'Vocabulary',
),
- 'User',
+ 'User',
),
- 'cache' => array(
- 'name' => 'node_' . $this->Croogo->roleId . '_' . $this->request->params['named']['type'] . '_' . $this->params['named']['slug'],
- 'config' => 'nodes_view',
+ 'cache' => array(
+ 'name' => 'node_' . $this->Croogo->roleId . '_' . $this->request->params['named']['type'] . '_' . $this->params['named']['slug'],
+ 'config' => 'nodes_view',
),
));
- } elseif ($id == null) {
- $this->Session->setFlash(__d('croogo', 'Invalid content'), 'default', array('class' => 'error'));
- $this->redirect('/');
- } else {
- $node = $this->Node->find('first', array(
- 'conditions' => array(
- 'Node.id' => $id,
- 'Node.status' => 1,
- 'OR' => array(
- 'Node.visibility_roles' => '',
- 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
+ } elseif ($id == null) {
+ $this->Session->setFlash(__d('croogo', 'Invalid content'), 'default', array('class' => 'error'));
+ $this->redirect('/');
+ } else {
+ $node = $this->Node->find('first', array(
+ 'conditions' => array(
+ 'Node.id' => $id,
+ 'Node.status' => 1,
+ 'OR' => array(
+ 'Node.visibility_roles' => '',
+ 'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
),
),
- 'contain' => array(
- 'Meta',
- 'Taxonomy' => array(
- 'Term',
- 'Vocabulary',
+ 'contain' => array(
+ 'Meta',
+ 'Taxonomy' => array(
+ 'Term',
+ 'Vocabulary',
),
- 'User',
+ 'User',
),
- 'cache' => array(
- 'name' => 'node_' . $this->Croogo->roleId . '_' . $id,
- 'config' => 'nodes_view',
+ 'cache' => array(
+ 'name' => 'node_' . $this->Croogo->roleId . '_' . $id,
+ 'config' => 'nodes_view',
),
));
- $this->Node->type = $node['Node']['type'];
- $type = $this->Node->Taxonomy->Vocabulary->Type->find('first', array(
- 'conditions' => array(
- 'Type.alias' => $this->Node->type,
+ $this->Node->type = $node['Node']['type'];
+ $type = $this->Node->Taxonomy->Vocabulary->Type->find('first', array(
+ 'conditions' => array(
+ 'Type.alias' => $this->Node->type,
),
- 'cache' => array(
- 'name' => 'type_' . $this->Node->type,
- 'config' => 'nodes_view',
+ 'cache' => array(
+ 'name' => 'type_' . $this->Node->type,
+ 'config' => 'nodes_view',
),
));
- }
+ }
- if (!isset($node['Node']['id'])) {
- $this->Session->setFlash(__d('croogo', 'Invalid content'), 'default', array('class' => 'error'));
- $this->redirect('/');
- }
+ if (!isset($node['Node']['id'])) {
+ $this->Session->setFlash(__d('croogo', 'Invalid content'), 'default', array('class' => 'error'));
+ $this->redirect('/');
+ }
- if ($node['Node']['comment_count'] > 0) {
- $comments = $this->Node->Comment->find('threaded', array(
- 'conditions' => array(
- 'Comment.node_id' => $node['Node']['id'],
- 'Comment.status' => 1,
+ if ($node['Node']['comment_count'] > 0) {
+ $comments = $this->Node->Comment->find('threaded', array(
+ 'conditions' => array(
+ 'Comment.node_id' => $node['Node']['id'],
+ 'Comment.status' => 1,
),
- 'contain' => array(
- 'User',
+ 'contain' => array(
+ 'User',
),
- 'cache' => array(
- 'name' => 'comment_node_' . $node['Node']['id'],
- 'config' => 'nodes_view',
+ 'cache' => array(
+ 'name' => 'comment_node_' . $node['Node']['id'],
+ 'config' => 'nodes_view',
),
));
- } else {
- $comments = array();
- }
+ } else {
+ $comments = array();
+ }
- $this->set('title_for_layout', $node['Node']['title']);
- $this->set(compact('node', 'type', 'comments'));
- $this->_viewFallback(array(
- 'view_' . $node['Node']['id'],
- 'view_' . $type['Type']['alias'],
+ $this->set('title_for_layout', $node['Node']['title']);
+ $this->set(compact('node', 'type', 'comments'));
+ $this->_viewFallback(array(
+ 'view_' . $node['Node']['id'],
+ 'view_' . $type['Type']['alias'],
));
- }
+}
/**
* View Fallback
@@ -752,67 +752,67 @@ public function view($id = null) {
* @return string
* @access protected
*/
- protected function _viewFallback($views) {
- if (is_string($views)) {
- $views = array($views);
- }
+protected function _viewFallback($views) {
+ if (is_string($views)) {
+ $views = array($views);
+ }
- if ($this->theme) {
- $viewPaths = App::path('View');
- foreach ($views as $view) {
- foreach ($viewPaths as $viewPath) {
- $viewPath = $viewPath . 'Themed' . DS . $this->theme . DS . $this->name . DS . $view . $this->ext;
- if (file_exists($viewPath)) {
- return $this->render($view);
- }
+ if ($this->theme) {
+ $viewPaths = App::path('View');
+ foreach ($views as $view) {
+ foreach ($viewPaths as $viewPath) {
+ $viewPath = $viewPath . 'Themed' . DS . $this->theme . DS . $this->name . DS . $view . $this->ext;
+ if (file_exists($viewPath)) {
+ return $this->render($view);
}
}
-
}
- if ($this->plugin && $this->plugin !== 'Nodes') {
- $views[] = $this->action;
- $viewPaths = App::path('View', $this->plugin);
- foreach ($views as $view) {
- foreach ($viewPaths as $viewPath) {
- $viewPath = $viewPath . $this->name . DS . $view . $this->ext;
- if (file_exists($viewPath)) {
- return $this->render($view);
- }
+ }
+
+ if ($this->plugin && $this->plugin !== 'Nodes') {
+ $views[] = $this->action;
+ $viewPaths = App::path('View', $this->plugin);
+ foreach ($views as $view) {
+ foreach ($viewPaths as $viewPath) {
+ $viewPath = $viewPath . $this->name . DS . $view . $this->ext;
+ if (file_exists($viewPath)) {
+ return $this->render($view);
}
}
+ }
- $nodesViewPaths = App::path('View', 'Nodes');
- foreach ($views as $view) {
- foreach ($nodesViewPaths as $viewPath) {
- $viewPath = $viewPath . $this->name . DS . $view . $this->ext;
- if (file_exists($viewPath)) {
- return $this->render($viewPath);
- }
+ $nodesViewPaths = App::path('View', 'Nodes');
+ foreach ($views as $view) {
+ foreach ($nodesViewPaths as $viewPath) {
+ $viewPath = $viewPath . $this->name . DS . $view . $this->ext;
+ if (file_exists($viewPath)) {
+ return $this->render($viewPath);
}
}
}
}
+}
/**
* Set common form variables to views
* @param array $type Type data
* @return void
*/
- protected function _setCommonVariables($type) {
- $typeAlias = $type['Type']['alias'];
- $this->Node->type = $typeAlias;
- $nodes = $this->Node->generateTreeList();
- $roles = $this->Node->User->Role->find('list');
- $users = $this->Node->User->find('list');
- $vocabularies = Hash::combine($type['Vocabulary'], '{n}.id', '{n}');
- $taxonomy = array();
- foreach ($type['Vocabulary'] as $vocabulary) {
- $vocabularyId = $vocabulary['id'];
- $taxonomy[$vocabularyId] = $this->Node->Taxonomy->getTree($vocabulary['alias'], array('taxonomyId' => true));
- }
- $this->set(compact('typeAlias', 'type', 'nodes', 'roles', 'vocabularies', 'taxonomy', 'users'));
+protected function _setCommonVariables($type) {
+ $typeAlias = $type['Type']['alias'];
+ $this->Node->type = $typeAlias;
+ $nodes = $this->Node->generateTreeList();
+ $roles = $this->Node->User->Role->find('list');
+ $users = $this->Node->User->find('list');
+ $vocabularies = Hash::combine($type['Vocabulary'], '{n}.id', '{n}');
+ $taxonomy = array();
+ foreach ($type['Vocabulary'] as $vocabulary) {
+ $vocabularyId = $vocabulary['id'];
+ $taxonomy[$vocabularyId] = $this->Node->Taxonomy->getTree($vocabulary['alias'], array('taxonomyId' => true));
}
+ $this->set(compact('typeAlias', 'type', 'nodes', 'roles', 'vocabularies', 'taxonomy', 'users'));
+}
/**
@@ -827,15 +827,15 @@ public function home(){
public function news(){
$this->layout = 'foundation_news';
- $this->set('title_for_layout', __d('croogo', 'Nodes'));
+ $this->set('title_for_layout', __d('croogo', 'Nodes'));
$this->paginate['Node']['type'] = 'promoted';
$this->paginate['Node']['conditions'] = array(
'OR' => array(
'Node.visibility_roles' => '',
'Node.visibility_roles LIKE' => '%"' . $this->Croogo->roleId . '"%',
- ),
- );
+ ),
+ );
if (isset($this->request->params['named']['type'])) {
$type = $this->Node->Taxonomy->Vocabulary->Type->findByAlias($this->request->params['named']['type']);
@@ -881,5 +881,76 @@ public function news(){
public function products(){
$this->layout = 'foundation';
+
+ $breads_dir=APP."plugin/Croogo/webroot/img/products/breads";
+ $sweets_dir=APP."plugin/Croogo/webroot/img/products/sweets";
+ $pies_dir=APP."plugin/Croogo/webroot/img/products/pies";
+ $biscuits_dir=APP."plugin/Croogo/webroot/img/products/biscuits";
+ if(isset($this->request->params['type'])){
+ $type=$this->request->params['type'];
+ }else{
+ $type = null;
+ }
+
+
+ switch ($type) {
+ //Breads
+ case "breads":
+ $dir=$breads_dir;
+ break;
+ //sweets and cakes
+ case "sweets":
+ $dir = $sweets_dir;
+ break;
+ //pies and drinks
+ case "pies":
+ $dir = $pies_dir;
+ break;
+ //biscuits
+ case "biscuits":
+ $dir = $biscuits_dir;
+ break;
+ default:
+ $dir = null;
+ break;
+ }
+ if(!$dir==null ){
+ $imgs = array_slice(scandir($dir,1),0,-2);
+ foreach ($imgs as $key => $img){
+ $imgs[$key] = $type.'/'.$img;
+ }
+
+ }else{
+ $imgs1 = scandir($breads_dir,1);
+ foreach ($imgs1 as $key => $img){
+ $imgs1[$key] = 'breads'.'/'.$img;
+ }
+
+ $imgs2 = scandir($sweets_dir,1);
+ foreach ($imgs2 as $key => $img){
+ $imgs2[$key] ='sweets'.'/'.$img;
+ }
+
+ $imgs3 = scandir($pies_dir,1);
+ foreach ($imgs3 as $key => $img){
+ $imgs3[$key] = 'pies'.'/'.$img;
+ }
+
+ $imgs4 = scandir($biscuits_dir,1);
+ foreach ($imgs4 as $key => $img){
+ $imgs4[$key] = 'biscuits'.'/'.$img;
+ }
+
+
+ $imgs = array_merge(array_slice($imgs1, 0, -2),array_slice($imgs2, 0, -2),array_slice($imgs3, 0, -2),array_slice($imgs4, 0, -2));
+ }
+
+ $this->set('images',$imgs );
+
+
+
+
+
}
+
}
View
21 app/Plugin/Nodes/View/Nodes/home.ctp
@@ -20,19 +20,19 @@
<div id="slider">
<ul data-orbit>
<li>
- <img src="http://placehold.it/1000x400&text=[ img 1 ]" />
+ <?php echo $this->Html->image('home_slider/1.jpg');?>
<div class="orbit-caption">...</div>
</li>
<li>
- <img src="http://placehold.it/1000x400&text=[ img 1 ]" />
+ <?php echo $this->Html->image('home_slider/2.jpg');?>
<div class="orbit-caption">...</div>
</li>
<li>
- <img src="http://placehold.it/1000x400&text=[ img 1 ]" />
+ <?php echo $this->Html->image('home_slider/3.jpg');?>
<div class="orbit-caption">...</div>
</li>
<li>
- <img src="http://placehold.it/1000x400&text=[ img 1 ]" />
+ <?php echo $this->Html->image('home_slider/4.jpg');?>
<div class="orbit-caption">...</div>
</li>
</ul>
@@ -45,17 +45,17 @@
<div class="row">
<div class="large-4 columns">
- <img src="http://placehold.it/400x300&text=[img]" />
+ <?php echo $this->Html->image('home_section/1.jpg');?>
<h4>This is a content section.</h4>
<p>Bacon ipsum dolor sit amet nulla ham qui sint exercitation eiusmod commodo, chuck duis velit. Aute in reprehenderit, dolore aliqua non est magna in labore pig pork biltong. Eiusmod swine spare ribs reprehenderit culpa. Boudin aliqua adipisicing rump corned beef.</p>
</div>
<div class="large-4 columns">
- <img src="http://placehold.it/400x300&text=[img]" />
+ <?php echo $this->Html->image('home_section/2.jpg');?>
<h4>This is a content section.</h4>
<p>Bacon ipsum dolor sit amet nulla ham qui sint exercitation eiusmod commodo, chuck duis velit. Aute in reprehenderit, dolore aliqua non est magna in labore pig pork biltong. Eiusmod swine spare ribs reprehenderit culpa. Boudin aliqua adipisicing rump corned beef.</p>
</div>
<div class="large-4 columns">
- <img src="http://placehold.it/400x300&text=[img]" />
+ <?php echo $this->Html->image('home_section/3.jpg');?>
<h4>This is a content section.</h4>
<p>Bacon ipsum dolor sit amet nulla ham qui sint exercitation eiusmod commodo, chuck duis velit. Aute in reprehenderit, dolore aliqua non est magna in labore pig pork biltong. Eiusmod swine spare ribs reprehenderit culpa. Boudin aliqua adipisicing rump corned beef.</p>
</div>
@@ -64,13 +64,14 @@
<div class="row">
<div class="large-12 columns">
<div class="panel">
- <h4>Get in touch!</h4>
+ <h4>Seems delicious?</h4>
<div class="row">
<div class="large-9 columns">
- <p>We'd love to hear from you, you attractive person you.</p>
+ <p>why not make a order now!</p>
</div>
<div class="large-3 columns">
- <a href="#" class="radius button right">Contact Us</a>
+ <a href="/personalBlog/contact" class="radius button right">Contact Us</a>
+
</div>
</div>
</div>
View
191 app/Plugin/Nodes/View/Nodes/products.ctp
@@ -7,170 +7,107 @@
<div class="large-12 columns">
<div class="nav-bar right">
<ul class="button-group">
- <li><a href="#" class="button">Link 1</a></li>
- <li><a href="#" class="button">Link 2</a></li>
- <li><a href="#" class="button">Link 3</a></li>
- <li><a href="#" class="button">Link 4</a></li>
- </ul>
- </div>
+ <li><?php echo $this->Html->link(
+ 'Breads',
+ '/products/breads',
+ array('class'=>'button')
+ );?></li>
+ <li><?php echo $this->Html->link(
+ 'Sweets & Cakes',
+ '/products/sweets',
+ array('class'=>'button')
+ );?></li>
+ <li><?php echo $this->Html->link(
+ 'pies & drinks',
+ '/products/pies',
+ array('class'=>'button')
+ );?></li>
+ <li><?php echo $this->Html->link(
+ 'Biscuits',
+ '/products/biscuits',
+ array('class'=>'button')
+ );?></li>
+ </ul>
+ </div>
+ </div>
</div>
+ <!-- End Top Bar -->
</div>
- <!-- End Top Bar -->
</div>
-</div>
-
-<!-- End Navigation -->
-<div class="row">
+ <!-- End Navigation -->
- <!-- Side Bar -->
+ <div class="row">
- <div class="large-4 small-12 columns">
+ <!-- Side Bar -->
- <img src="http://placehold.it/500x500&text=Logo">
+ <div class="large-4 small-12 columns">
- <div class="hide-for-small panel">
- <h3>Header</h3>
- <h5 class="subheader">Risus ligula, aliquam nec fermentum vitae, sollicitudin eget urna. Donec dignissim nibh fermentum odio ornare sagittis.
- </h5>
- </div>
+ <img src="http://placehold.it/500x500&text=Logo">
- <a href="#">
- <div class="panel callout radius">
- <h6>99&nbsp; items in your cart</h6>
+ <div class="hide-for-small panel">
+ <h3>Most popular</h3>
+ <h5 class="subheader">Description of the most popular products
+ </h5>
</div>
- </a>
-
- </div>
-
- <!-- End Side Bar -->
-
-
- <!-- Thumbnails -->
- <div class="large-8 columns">
- <div class="row">
-
- <div class="large-4 small-6 columns">
- <img src="http://placehold.it/1000x1000&text=Thumbnail">
-
- <div class="panel">
- <h5>Item Name</h5>
- <h6 class="subheader">$000.00</h6>
- </div>
- </div>
-
- <div class="large-4 small-6 columns">
- <img src="http://placehold.it/500x500&text=Thumbnail">
-
- <div class="panel">
- <h5>Item Name</h5>
- <h6 class="subheader">$000.00</h6>
- </div>
- </div>
-
- <div class="large-4 small-6 columns">
- <img src="http://placehold.it/500x500&text=Thumbnail">
+ </div>
- <div class="panel">
- <h5>Item Name</h5>
- <h6 class="subheader">$000.00</h6>
- </div>
- </div>
+ <!-- End Side Bar -->
- <div class="large-4 small-6 columns">
- <img src="http://placehold.it/500x500&text=Thumbnail">
- <div class="panel">
- <h5>Item Name</h5>
- <h6 class="subheader">$000.00</h6>
- </div>
- </div>
+ <!-- Thumbnails -->
- <div class="large-4 small-6 columns">
- <img src="http://placehold.it/500x500&text=Thumbnail">
+ <div class="large-8 columns">
+ <div class="row">
+ <?php
- <div class="panel">
- <h5>Item Name</h5>
- <h6 class="subheader">$000.00</h6>
- </div>
- </div>
- <div class="large-4 small-6 columns">
- <img src="http://placehold.it/500x500&text=Thumbnail">
+ foreach ($images as &$image)
+ {