setId() public method

Sets (overwrites) the id of the subcategory see {@link $id}.
public setId ( string $id ) : static
$id string A translation key eg 'General_Overview'.
return static
Beispiel #1
0
 public function addSubcategories(&$subcategories)
 {
     $idSite = Common::getRequestVar('idSite', 0, 'int');
     if (!$idSite) {
         // fallback for eg API.getReportMetadata which uses idSites
         $idSite = Common::getRequestVar('idSites', 0, 'int');
         if (!$idSite) {
             return;
         }
     }
     $goals = API::getInstance()->getGoals($idSite);
     $order = 900;
     foreach ($goals as $goal) {
         $category = new Subcategory();
         $category->setName($goal['name']);
         $category->setCategoryId('Goals_Goals');
         $category->setId($goal['idgoal']);
         $category->setOrder($order++);
         $subcategories[] = $category;
     }
 }
Beispiel #2
0
 private function addDefaultSubcategory(&$subcategories)
 {
     $subcategory = new Subcategory();
     $subcategory->setName('Dashboard_Dashboard');
     $subcategory->setCategoryId('Dashboard_Dashboard');
     $subcategory->setId('1');
     $subcategory->setOrder(1);
     $subcategories[] = $subcategory;
 }
 public function addSubcategories(&$subcategories)
 {
     $idSite = Common::getRequestVar('idSite', 0, 'int');
     if (!$idSite) {
         // fallback for eg API.getReportMetadata which uses idSites
         $idSite = Common::getRequestVar('idSites', 0, 'int');
         if (!$idSite) {
             return;
         }
     }
     $dimensions = $this->configuration->getCustomDimensionsForSite($idSite);
     $order = 70;
     foreach ($dimensions as $dimension) {
         if (!$dimension['active']) {
             continue;
         }
         $category = new Subcategory();
         $category->setName($dimension['name']);
         if ($dimension['scope'] === CustomDimensions::SCOPE_ACTION) {
             $category->setCategoryId('General_Actions');
         } elseif ($dimension['scope'] === CustomDimensions::SCOPE_VISIT) {
             $category->setCategoryId('General_Visitors');
         }
         $category->setId('customdimension' . $dimension['idcustomdimension']);
         $category->setOrder($order++);
         $subcategories[] = $category;
     }
 }
Beispiel #4
0
 private function createSubcategory($categoryId, $subcategoryId)
 {
     $subcategory = new Subcategory();
     $subcategory->setCategoryId($categoryId);
     $subcategory->setId($subcategoryId);
     return $subcategory;
 }