/** * gets the form post action for the current block type given the area * @param Area $a * @return string */ public function getBlockTypeAliasAction(&$a) { $step = ($_REQUEST['step']) ? '&step=' . $_REQUEST['step'] : ''; $arHandle = urlencode($a->getAreaHandle()); $c = $a->getAreaCollectionObject(); $cID = $c->getCollectionID(); $str = DIR_REL . "/" . DISPATCHER_FILENAME . "?cID={$cID}&areaName={$arHandle}&mode=edit&btask=alias" . $step . '&' . $valt->getParameter(); return $str; }
/** * sets the permissions on the area?? * @todo Documnetation?? not sure what type $cp is or how this is used? * @param Area $area * @param unknown $cp */ function setAreaPermissions(&$area, &$cp) { $db = Loader::db(); if ($area->overrideCollectionPermissions()) { $setBlocksVia = "AREA"; } else { if ($area->getAreaCollectionInheritID() > 0) { // see if the area/page we're supposed to be getting these from actually has a record $arOverrideCollectionPermissions = $db->getOne("select arOverrideCollectionPermissions from Areas where cID = ? and arHandle = ?", array($area->getAreaCollectionInheritID(), $area->getAreaHandle())); if ($arOverrideCollectionPermissions) { $setBlocksVia = "AREA"; } } if (!isset($setBlocksVia)) { $setBlocksVia = "PAGE"; } } if ($setBlocksVia == "AREA") { $c = $area->getAreaCollectionObject(); $cpID = $area->getAreaCollectionInheritID() > 0 ? $area->getAreaCollectionInheritID() : $c->getCollectionID(); $v = array($cpID, $area->getAreaHandle(), $this->getBlockTypeID()); $q = "select uID, gID from AreaGroupBlockTypes where cID = ? and arHandle = ? and btID = ?"; $r = $db->query($q, $v); while ($row = $r->fetchRow()) { if ($row['uID'] != 0) { $this->addBTUArray[] = $row['uID']; } if ($row['gID'] != 0) { $this->addBTGArray[] = $row['gID']; } } } else { $cID = $area->getCollectionID(); // we grab all the uID/gID combos from PagePermissions that can edit the page // then we allow them to add all the blocks they want $cInheritCID = $db->getOne('select cInheritPermissionsFromCID from Pages where cID = ?', array($cID)); $v = array($cInheritCID); $q = "select uID, gID, cgPermissions from PagePermissions where cID = ?"; $r = $db->query($q, $v); while ($row = $r->fetchRow()) { if ($row['uID'] != 0 && strpos($row['cgPermissions'], 'wa') !== false) { $this->addBTUArray[] = $row['uID']; } if ($row['gID'] != 0 && strpos($row['cgPermissions'], 'wa') !== false) { $this->addBTGArray[] = $row['gID']; } } } }