/**
  * Override to support adding special tags
  * @param string $nodeId
  * @return array
  */
 public function getData($nodeId)
 {
     $data = parent::getData($nodeId);
     if ($nodeId == 'source') {
         $data[1] = $data[0];
         $data[0] = array('expanded' => false, 'text' => 'Special Tags');
         $data[0]['children'] = $this->resolveSpecialTagNodes();
     }
     return $data;
 }
コード例 #2
0
 public function actionRelationsAndAttributesTree($type, $treeType, $id = null, $nodeId = null, $isBeingCopied = false)
 {
     $postData = PostUtil::getData();
     $savedReport = null;
     $report = null;
     $this->resolveSavedReportAndReportByPostData($postData, $savedReport, $report, $type, $id, (bool) $isBeingCopied);
     if ($nodeId != null) {
         $reportToTreeAdapter = new ReportRelationsAndAttributesToTreeAdapter($report, $treeType);
         echo ZurmoTreeView::saveDataAsJson($reportToTreeAdapter->getData($nodeId));
         Yii::app()->end(0, false);
     }
     $view = new ReportRelationsAndAttributesTreeView($type, $treeType, 'edit-form');
     $content = $view->render();
     Yii::app()->getClientScript()->setToAjaxMode();
     Yii::app()->getClientScript()->render($content);
     echo $content;
 }
 /**
  * @depends testNextedGroupBys
  */
 public function testWhereNestedGroupBysAndGettingDataForOrderBy()
 {
     $report = new Report();
     $report->setType(Report::TYPE_SUMMATION);
     $groupBy = new GroupByForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
     $groupBy->attributeIndexOrDerivedType = 'hasOne___name';
     $groupBy->axis = 'x';
     $report->addGroupBy($groupBy);
     $report->setModuleClassName('ReportsTestModule');
     $adapter = new ReportRelationsAndAttributesToTreeAdapter($report, ComponentForReportForm::TYPE_ORDER_BYS);
     $data = $adapter->getData(ComponentForReportForm::TYPE_ORDER_BYS . '_hasOne');
     $this->assertEquals('OrderBys_hasOne___name', $data[0]['id']);
     $this->assertEquals('OrderBys_hasOne___createdByUser', $data[1]['id']);
     $this->assertEquals('OrderBys_hasOne___hasMany3', $data[2]['id']);
     $this->assertEquals('OrderBys_hasOne___modifiedByUser', $data[3]['id']);
     $this->assertEquals('OrderBys_hasOne___owner', $data[4]['id']);
 }