protected function getBreadCrumbs($actionId) { $result = array(); switch ($actionId) { case 'index': $parentId = getParam('parent_id', NULL); // build bread crumbs using parent nodes if ($parentId) { $result = array(_('Test catalog') => $this->createUrl('index')); $titles = array(); $urls = array(); $gotRoot = FALSE; while (!$gotRoot) { $model = TestCatalogMl::model()->byLanguage()->find('catalog_id = :value', array(':value' => $parentId)); if ($model) { $parentId = (int) $model->parent_id; $titles[] = $model->getValue(); $urls[] = $this->createUrl('index', array('parent_id' => $model->catalog_id)); if ($parentId == 0) { $gotRoot = TRUE; } } else { $gotRoot = TRUE; } } if ($titles !== array()) { while ($titles !== array()) { $result[array_pop($titles)] = array_pop($urls); } } } else { $result = array(_('Test catalog')); } break; case 'add': $parentNodeModel = TestCatalogMl::model()->byLanguage()->find('catalog_id = :value', array(':value' => getParam('parent_id'))); if ($parentNodeModel) { $result = array(_('Test catalog') => $this->createUrl('index')); $parentId = $parentNodeModel->parent_id; if ($parentId) { $titles = array(); $urls = array(); $gotRoot = FALSE; while (!$gotRoot) { $model = TestCatalogMl::model()->byLanguage()->find('catalog_id = :value', array(':value' => $parentId)); if ($model) { $parentId = (int) $model->parent_id; $titles[] = $model->getValue(); $urls[] = $this->createUrl('index', array('parent_id' => $model->catalog_id)); if ($parentId == 0) { $gotRoot = TRUE; } } else { $gotRoot = TRUE; } } if ($titles !== array()) { while ($titles !== array()) { $title = array_pop($titles); $url = array_pop($urls); $result[$title] = $url; } } } $result[$parentNodeModel->getValue()] = $this->createUrl('index', array('parent_id' => $parentNodeModel->catalog_id)); $result[] = _('Creating a new record'); } else { $result = array(_('Test catalog') => $this->createUrl('index'), _('Creating a new record')); } break; case 'edit': $model = TestCatalogMl::model()->byLanguage()->find('catalog_id = :value', array(':value' => getParam('id'))); $parentId = $model->parent_id; if ($parentId) { $result = array(_('Test catalog') => $this->createUrl('index')); $titles = array(); $urls = array(); $gotRoot = FALSE; while (!$gotRoot) { $model = TestCatalogMl::model()->byLanguage()->find('catalog_id = :value', array(':value' => $parentId)); if ($model) { $parentId = (int) $model->parent_id; $titles[] = $model->getValue(); $urls[] = $this->createUrl('index', array('parent_id' => $model->catalog_id)); if ($parentId == 0) { $gotRoot = TRUE; } } else { $gotRoot = TRUE; } } if ($titles !== array()) { while ($titles !== array()) { $title = array_pop($titles); $url = array_pop($urls); $result[$title] = $url; } } $result[] = _('Editing a record'); } else { $result = array(_('Test catalog') => $this->createUrl('index'), _('Editing a record')); } break; case 'groupEdit': $result = array(_('Test catalog') => $this->createUrl('index'), _('Edit records')); break; case 'articles': $result = array(_('Test catalog articles')); break; case 'addArticle': $result = array(_('Test catalog articles') => $this->createUrl('articles'), _('Add catalog article')); break; case 'editArticle': $result = array(_('Test catalog articles') => $this->createUrl('articles'), _('Edit catalog article')); break; } return $result; }
public function getCatalogOptions() { return TestCatalogMl::getOptions(_('Select category'), NULL, TRUE); }