/** * * @param unknown_type $element */ private function _addActionsDisplayGroupElement($element) { $displayGroup = $this->getDisplayGroup("zfBootstrapFormActions"); if ($displayGroup === null) { $displayGroup = $this->addDisplayGroup(array($element->getName()), "zfBootstrapFormActions", array("decorators" => array("FormElements", array("HtmlTag", array("tag" => "div", "class" => "actions"))))); } else { $displayGroup->addElement($element); } return $displayGroup; }
/** * Get category path * @param unknown_type $category */ public function getCategoryPath($category, $store) { $categoryPath = str_replace('/', '_._._', $category->getName()) . '/' . $category->getId(); while ($category->getParentId() > 0) { $parentCategory = $category->getParentCategory(); $category = Mage::getModel('catalog/category')->setStoreId($store->getId())->load($parentCategory->getId()); if (in_array($category->getId(), $this->allowCategoryIds[$store->getId()])) { if ($category && $category->getIsActive() && $category->getIncludeInMenu()) { $categoryPath = str_replace('/', '_._._', $category->getName()) . '/' . $category->getId() . '/' . $categoryPath; } } } return trim($categoryPath, '/'); }
/** * Get category path * @param unknown_type $category */ public function getCategoryPath($category, $store) { $currentCategory = $category; $categoryPath = str_replace('/', '_._._', $category->getName()) . '/' . $category->getId(); while ($category->getParentId() > 0) { $category = $category->getParentCategory(); if (in_array($category->getId(), $this->allowCategoryIds[$store->getId()])) { $category->setStoreId($store->getId()); $categoryPath = str_replace('/', '_._._', $category->getName()) . '/' . $category->getId() . '/' . $categoryPath; } } return trim($categoryPath, '/'); }
/** * TODO PHPDoc * Enter description here ... * @param unknown_type $field * @param unknown_type $is_multiple * @param unknown_type $object * @param unknown_type $template */ public function renderEditFieldFile($field, $is_multiple, $object, $template) { list($template_block) = def_module::loadTemplates("data/reflection/{$template}", "reflection_field_file"); $regexp = "|^" . CURRENT_WORKING_DIR . "|"; $block_arr = array(); if ($is_multiple) { //TODO } else { $field_name = $field->getName(); $block_arr['attribute:name'] = $field_name; $block_arr['attribute:title'] = $field->getTitle(); $block_arr['attribute:tip'] = $field->getTip(); $block_arr['attribute:maxsize'] = $this->getAllowedMaxFileSize(); $block_arr['attribute:field_id'] = $field->getId(); $value = $object ? $object->getValue($field->getName()) : ""; if ($value) { $block_arr['attribute:relative-path'] = $value->getFilePath(true); $block_arr['node:value'] = $value->getFilePath(); } else { $block_arr['node:value'] = ""; } if ($object) { $block_arr['void:object_id'] = $object->getId(); } $block_arr['attribute:input_name'] = $object ? "data[" . $object->getId() . "][{$field_name}]" : "data[new][{$field_name}]"; $folder_name = $field_name . '/'; $general_name = "./files/"; if ($value instanceof umiFile) { if ($value->getIsBroken() == false) { $value = false; } } if ($value) { $destination_folder = "." . preg_replace($regexp, "", $value->getDirName()); } else { $destination_folder = $general_name . (is_dir($general_name . $folder_name) ? $folder_name : ''); } $block_arr['attribute:destination-folder'] = $destination_folder; } return def_module::parseTemplate($template_block, $block_arr); }
/** * * @param unknown_type $rs */ private static function _getObject($rs) { $ret = new User(); $ret->setAvatar($rs->getAvatar()); $ret->setCos($rs->getCos()); $ret->setCreationDate($rs->getCreationDate()); $ret->setEmail($rs->getEmail()); $ret->setEnabled($rs->getEnabled()); $ret->setId($rs->getId()); $ret->setName($rs->getName()); $ret->setUsername($rs->getUsername()); // // The following is a workaround on the fact that the translation of this // serialized object to the database gets all broken, due to the fact of PHP // introducing NULL bytes around the '*' that is prepended before protected // variable members, in the serialized mode. This method replaces those // problematic NULL bytes with an identifier string '~~NULL_BYTE~~', // rendering serialization and unserialization of these specific kinds of // object safe. Credits to travis@travishegner.com on: // http://pt.php.net/manual/en/function.serialize.php#96504 // $unsafeSerializedNotifications = str_replace(CINTIENT_NULL_BYTE_TOKEN, "", $rs->getNotifications()); if (($notifications = unserialize($unsafeSerializedNotifications)) === false) { $notifications = array(); } $ret->setNotifications($notifications); $ret->resetSignature(); return $ret; }