function test_Sites_set() { //Arrange $id = null; $services_id = null; $name = 'hotel deluxe'; $analytics_profile = '5271170'; $test_site = new Sites($id, $services_id, $name, $analytics_profile); //Act $test_site->setName('hotel max'); $result1 = $test_site->getName(); $test_site->setAnalyticsProfile('5271201'); $result2 = $test_site->getAnalyticsProfile(); //Assert $this->assertEquals('hotel max', $result1); $this->assertEquals('5271201', $result2); }
$root_cststyle = ''; $sitePNAME = $pages[0]['PNAME']; } else { $node_id = 1; $root_id = 'root_1'; $root_name = $itext['TXT_PAGES'] != '' ? $itext['TXT_PAGES'] : '$TXT_PAGES'; $root_cststyle = 'root'; if (!$pages[0]['RSUB']) { $root_cststyle .= ' nosub'; } } $props = array('TREE_ID' => $tree_id, 'TREE_LEVEL' => $tree_level, 'ID' => $root_id, 'CAPTION' => $root_name, 'URL' => $root_link, 'IC' => $this->imgpath . '/window/x.gif', 'EXP' => 'true', 'CHK' => 'false', 'CSTSTYLE' => $root_cststyle, 'TARGET' => '', 'TITLE' => '', 'SVRLOAD' => 'false', 'YG_ID' => $pages[$node_id]['ID'] . '-' . $siteID, 'YG_TYPE' => 'page', 'YG_PROPERTY' => 'name', 'PNAME' => $sitePNAME); array_push($xml_tree, array('OBJECTID' => $tree_id, 'LEVEL' => $tree_level++, 'PROPS' => $props)); $siteMgr = new Sites(); for ($i = 0; $i < count($sites); $i++) { $sitename = $siteMgr->getName($sites[$i]['ID']); if ($sites[$i]['ID'] == $siteID) { $PageMgr = new PageMgr($sites[$i]['ID']); $yo = $PageMgr->tree->nest($pages); gen_tree($yo[$node_id]['CHILDREN'], $siteID, $icons->icon, $this->imgpath, $xml_tree, $tree_id, $tree_level, $itext, $maxlevels, $yo[$node_id]); } } function gen_tree($current, $site = 1, $icons, $imgpath, &$xml_tree, &$tree_id, &$tree_level, $itext, $maxlevels, $currentnode) { if ($tree_level > $maxlevels) { $tree_level--; return; } $svrload = 'false'; if ($tree_level == (int) $maxlevels) { $svrload = 'true';
/** * Gets the parents of the specified Page * * @param int $pageId Page Id * @return array Array of parent Pages */ function getParents($pageId) { $pageId = (int) $pageId; if ($this->permissions->checkInternal($this->_uid, $pageId, "RREAD")) { $parentnodes = $this->tree->getParents($pageId, $this->tree->getRoot()); $parentnodeidsql = implode(',', $parentnodes); if (strlen($parentnodeidsql) == 0) { $parentnodeidsql = 0; } $sql = "SELECT\n\t\t\t\t\t\tgroup2.LFT, group2.RGT, group2.VERSIONPUBLISHED, group2.ID AS ID, group2.LEVEL AS LEVEL, group2.PARENT AS PARENT, group2.PNAME AS PNAME,\n\t\t\t\t\t\tMAX(prop.VERSION) AS VERSION, prop.ACTIVE AS ACTIVE, prop.HIDDEN AS HIDDEN, prop.LOCKED AS LOCKED, prop.TEMPLATEID AS TEMPLATEID, pv.NAME AS NAME\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{$this->table} AS group2, yg_site_" . $this->_site . "_properties AS prop, yg_site_" . $this->_site . "_propsv as pv\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t(group2.ID = prop.OBJECTID) AND (group2.ID IN ({$parentnodeidsql})) AND (prop.VERSION = (SELECT MAX(VERSION) AS VERSION FROM yg_site_" . $this->_site . "_properties AS rgt WHERE rgt.OBJECTID = prop.OBJECTID)) AND\n\t\t\t\t\t\t(pv.OID = prop.ID)\n\t\t\t\t\tGROUP BY\n\t\t\t\t\t\tgroup2.LFT, group2.RGT, group2.VERSIONPUBLISHED, group2.ID ORDER BY group2.LEVEL DESC;"; $parents0 = $this->cacheExecuteGetArray($sql); // Prepare weird array dimension $parents = array(); for ($i = 0; $i < count($parents0); $i++) { $parents[$i][] = $parents0[$i]; } $siteMgr = new Sites(); $siteName = $siteMgr->getName($this->_site); if (count($parents) > 0) { $parents[count($parents) - 1][0]['NAME'] = $siteName; } else { $parents[0][0]['NAME'] = $siteName; } return $parents; } else { return false; } }