public static function get_extractor($vertical, $cart, $customFieldsModel) { $extra_fields = ""; switch ('retail') { //($vertical) { case 'retail': require 'Retail.php'; $retail_model = new Retail(); $extra_fields = $retail_model->getFields($cart, $customFieldsModel); break; case 'ticketing': require 'Ticketing.php'; $ticketing_model = new Ticketing(); $extra_fields = $ticketing_model->getFields($cart, $customFieldsModel); break; case 'services': require 'Services.php'; $services_model = new Services(); $extra_fields = $services_model->getFields($cart, $customFieldsModel); break; case 'digital': require 'Digitalgoods.php'; $digitalgoods_model = new Digitalgoods(); $extra_fields = $digitalgoods_model->getFields($cart, $customFieldsModel); break; default: require 'Retail.php'; $retail_model = new Retail(); $extra_fields = $retail_model->getFields($cart, $customFieldsModel); break; } return $extra_fields; }
public function setUp() { $services = new Services(); $services->set('depA', 'a'); $services->set('depB', 'b'); $services->set('Exception', new \Exception()); $this->manager = new Manager($services); }
/** * Get the services object * * @return Services */ public function getServicesObject() { /* * * !! IMPORTANT !! * * We can't use the classmap for the Services key because Services is * reserved by PHP SOAP and will therefore always return an stdClass. * */ $oServices = new Services(); $oServices->setService($this->Services->Service); return $oServices; }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function buildContent() { $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); $repository = $this->getRepository(); // get the search type. $searchType = HarmoniType::fromString(urldecode(RequestContext::value('search_type'))); // Get the Search criteria $searchModules = Services::getService("RepositorySearchModules"); $searchCriteria = $searchModules->getSearchCriteria($repository, $searchType); // function links ob_start(); print _("Collection") . ": "; RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository); $layout = new Block(ob_get_contents(), 2); ob_end_clean(); $actionRows->add($layout, null, null, CENTER, CENTER); ob_start(); print "<p>"; print _("Some <em>Collections</em>, <em>Exhibitions</em>, <em>Assets</em>, and <em>Slide-Shows</em> may be restricted to certain users or groups of users. Log in above to ensure your greatest access to all parts of the system."); print "</p>"; $introText = new Block(ob_get_contents(), 2); ob_end_clean(); $actionRows->add($introText, null, null, CENTER, CENTER); //*********************************** // Get the assets to display //*********************************** $assets = $repository->getAssetsBySearch($searchCriteria, $searchType, new HarmoniProperties(new Type('Repository', 'edu.middlebury', 'null'))); //*********************************** // print the results //*********************************** $resultPrinter = new IteratorResultPrinter($assets, 2, 6, "printAssetShort", $harmoni); $resultLayout = $resultPrinter->getLayout(); $actionRows->add($resultLayout, "100%", null, LEFT, CENTER); }
/** * Answer the html string for an icon that displays authorization state * * @param object Id $qualifierId * @return string * @access public * @static * @since 11/29/06 */ static function getAZIcon($qualifierId) { ob_start(); $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); try { $isAuthorized = $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view_authorizations"), $qualifierId); } catch (UnknownIdException $e) { $isAuthorized = $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view_authorizations"), $idManager->getId("edu.middlebury.authorization.root")); } if ($isAuthorized) { $onclick = "onclick=\"AuthZViewer.run('" . addslashes($qualifierId->getIdString()) . "', this);\" style='cursor: pointer;' "; } else { $onclick = ''; } try { $isPublicAuthorized = $authZ->isAuthorized($idManager->getId("edu.middlebury.agents.everyone"), $idManager->getId("edu.middlebury.authorization.view"), $qualifierId); } catch (UnknownIdException $e) { $isPublicAuthorized = true; } if ($isPublicAuthorized) { print "\n<img class='az_icon' src='" . POLYPHONY_PATH . "/icons/view_public.gif' alt='" . "Public-Viewable" . "' title='" . "Public-Viewable" . "' " . $onclick . "/> "; } else { if ($authZ->isAuthorized($idManager->getId("edu.middlebury.agents.users"), $idManager->getId("edu.middlebury.authorization.view"), $qualifierId) || $authZ->isAuthorized($idManager->getId("edu.middlebury.institute"), $idManager->getId("edu.middlebury.authorization.view"), $qualifierId)) { print "\n<img class='az_icon' src='" . POLYPHONY_PATH . "/icons/view_institute.gif' alt='" . "Institution-Viewable" . "' title='" . "Institution-Viewable" . "' " . $onclick . "/> "; } else { print "\n<img class='az_icon' src='" . POLYPHONY_PATH . "/icons/view_limited.gif' alt='" . "Viewable by some people" . "' title='" . "Viewable by some people" . "' " . $onclick . "/> "; } } return ob_get_clean(); }
/** * Constructor * * @param integer dbIndex The database connection as returned by the DBHandler. * @return object * @access public * @since 2/8/05 */ function __construct() { $idManager = Services::getService("Id"); $this->id = $idManager->getId("edu.middlebury.agents.anonymous"); $this->type = new Type("Agents", "edu.middlebury.harmoni", "Any/Anonymous", _("Special users that can represent anyone or unknown users.")); $this->propertiesArray = array(); }
/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 1/26/09 */ public function visitBlock(BlockSiteComponent $siteComponent) { $view = new Participation_View($siteComponent); $idMgr = Services::getService('Id'); $azMgr = Services::getService('AuthZ'); // get create actions if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $siteComponent->getQualifierId()) == TRUE) { $this->_actions[] = new Participation_CreateAction($view, $siteComponent); } // get comment actions $commentsManager = CommentManager::instance(); $comments = $commentsManager->getAllComments($siteComponent->getAsset(), DESC); while ($comments->hasNext()) { $comment = $comments->next(); if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.comment'), $siteComponent->getQualifierId()) == TRUE) { $this->_actions[] = new Participation_CommentAction($view, $comment); } } // get history actions $pluginManager = Services::getService('PluginManager'); $plugin = $pluginManager->getPlugin($siteComponent->getAsset()); if ($plugin->supportsVersioning()) { $versions = $plugin->getVersions(); $firstVersion = 0; foreach ($versions as $version) { if ($version->getNumber() != 1) { if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $siteComponent->getQualifierId()) == TRUE) { $this->_actions[] = new Participation_HistoryAction($view, $siteComponent, $version); } } } } }
public function indexAction() { $this->view->bodyClass = 'pg-interna'; $vista = Services::get('vista_rest'); $this->view->listas = $vista->getListasBusca(); $form = new Site_Form_FaleConoscoForm(); $this->view->form = $form; $params = $this->_request->getParams(); $this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/quem-somos.js'); $vista = Services::get('vista_rest'); $users = $vista->getDadosUsuarios(); $grouped = array(); $groups = array(); array_walk($users, function ($user) use(&$grouped, &$groups) { $group = String::RemoveIndex($user['Equipesite']); $groups[] = strtolower($group); $grouped[$group][] = $user; }); $title = 'Equipe AG3 Imóveis'; $filterGroup = $this->getRequest()->getParam('t'); if (in_array($filterGroup, $groups)) { $title = ucwords($filterGroup); $grouped = array($title => $grouped[$title]); } $this->view->showGroups = !in_array($filterGroup, $groups); $this->view->title = $title; $this->view->users = $grouped; }
/** * Exporter of partstructures * * Adds partstructure elements to the xml, which contain the necessary * information to create the same partstructure. * * @access public * @since 12/6/06 */ function getFileParts() { $idManager = Services::getService("Id"); $this->_info = array(); $FILE_URL_ID = $idManager->getId("FILE_URL"); $FILE_NAME_ID = $idManager->getId("FILE_NAME"); $FILE_SIZE_ID = $idManager->getId("FILE_SIZE"); $FILE_DIME_ID = $idManager->getId("DIMENSIONS"); $MIME_TYPE_ID = $idManager->getId("MIME_TYPE"); $THUMB_DATA_ID = $idManager->getId("THUMBNAIL_DATA"); $THUMB_MIME_ID = $idManager->getId("THUMBNAIL_MIME_TYPE"); $THUMB_DIME_ID = $idManager->getId("THUMBNAIL_DIMENSIONS"); $parts = $this->_object->getPartsByPartStructure($FILE_URL_ID); if ($parts->count() == 1) { $part = $parts->next(); $this->_info['f_url'] = $part->getValue(); } $parts = $this->_object->getPartsByPartStructure($FILE_NAME_ID); if ($parts->count() == 1) { $part = $parts->next(); $path = $this->_fileDir . "/" . $part->getValue(); // CHECK FOR FILE NAME UNIQUENESS HERE // $this->_dataFile = fopen($path, "wb"); $this->_info['f_name'] = basename($path); } $parts = $this->_object->getPartsByPartStructure($FILE_SIZE_ID); if ($parts->count() == 1) { $part = $parts->next(); $this->_info['f_size'] = $part->getValue(); } $parts = $this->_object->getPartsByPartStructure($FILE_DIME_ID); if ($parts->count() == 1) { $part = $parts->next(); $this->_info['f_dime'] = $part->getValue(); } $parts = $this->_object->getPartsByPartStructure($MIME_TYPE_ID); if ($parts->count() == 1) { $part = $parts->next(); $this->_info['f_mime'] = $part->getValue(); } $path = $this->_fileDir . "/THUMB_" . $this->_info['f_name']; $this->_info['t_name'] = basename($path); $this->_thumbFile = fopen($path, "wb"); $parts = $this->_object->getPartsByPartStructure($THUMB_DATA_ID); if ($parts->count() == 1) { $part = $parts->next(); fwrite($this->_thumbFile, $part->getValue()); fclose($this->_thumbFile); } $parts = $this->_object->getPartsByPartStructure($THUMB_MIME_ID); if ($parts->count() == 1) { $part = $parts->next(); $this->_info['t_mime'] = $part->getValue(); } $parts = $this->_object->getPartsByPartStructure($THUMB_DIME_ID); if ($parts->count() == 1) { $part = $parts->next(); $this->_info['t_dime'] = $part->getValue(); } }
public function login($email = false, $passwd = false) { $email || ($email = $this->getPost('email')); $passwd || ($passwd = $this->getPost('passwd')); $orbit = new Orbit(); $client = $orbit->get('client/login', 1, 1, array('email' => $email, 'passwd' => $passwd)); if ($client['status'] == 200) { $phones = $orbit->get('client/phones/' . $client['uid']['id']); UID::set($client['uid']); UID::set('phones', $phones['phones']); $orbit = new Orbit(); $favRequest = $orbit->get('client/countfav', 1, 1, array('id' => UID::get('id'))); $favs = $favRequest['fav']; $cartRequest = $orbit->get('client/countcart', 1, 1, array('id' => UID::get('id'))); $carts = $cartRequest['cart']; $this->commitReplace($carts, '#cartitems'); $this->commitReplace($favs, '#favitems'); $product_id = $this->getQueryString('product_id'); if ($product_id) { $productPage = Services::get('products'); $productPage->setId($product_id); $productPage->viewProduct(); return; } $home = Services::get('home'); $home->homePage(); return; } $this->commitReplace('O e-mail e senha não foram encontrados', '#loginmsg'); $this->commitShow('#loginmsg'); }
/** * @see lib/modules/CommandModule::execute() */ public function execute($user, $target, $message) { // split message $messageEx = explode(' ', $message); if ($target[0] != '#') { $target = $messageEx[1]; unset($messageEx[1]); $messageEx = array_values($messageEx); } $access = $this->bot->getAccess($target, Services::getUserManager()->getUser($user->getUuid())->accountname); if ($access < $this->bot->getNeededAccess($target, $this->originalName)) { return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied')); } if (count($messageEx) == 2) { // check target access if ($access < $this->bot->getAccess($target, Services::getUserManager()->getUserByNick($messageEx[1])->accountname)) { return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied')); } else { Services::getConnection()->getProtocol()->sendKick($this->bot->getUuid(), $target, $messageEx[1], $user->getNick()); } $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success')); } else { unset($messageEx[0]); $username = $messageEx[1]; unset($messageEx[1]); // check target access // todo: abort when target has no account if ($access < $this->bot->getAccess($target, Services::getUserManager()->getUserByNick($username)->accountname)) { return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied')); } else { Services::getConnection()->getProtocol()->sendKick($this->bot->getUuid(), $target, $username, $user->getNick() . ': ' . implode(' ', $messageEx)); } $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success')); } }
/** * Build the content for this action * * @return void * @access public * @since 4/26/05 */ function buildContent() { $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); $idManager = Services::getService("Id"); $repositoryManager = Services::getService("Repository"); $repository = $repositoryManager->getRepository($idManager->getId(RequestContext::value('collection_id'))); $asset = $repository->getAsset($idManager->getId(RequestContext::value('asset_id'))); // Remove this asset from the tagging manager $tagManager = Services::getService('Tagging'); $tagManager->deleteItems(TaggedItem::forId($asset->getId(), 'concerto')); // Log the action if (Services::serviceRunning("Logging")) { $loggingManager = Services::getService("Logging"); $log = $loggingManager->getLogForWriting("Concerto"); $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified."); $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events."); $item = new AgentNodeEntryItem("Delete Node", "Asset deleted:\n<br/> " . $asset->getDisplayName()); $item->addNodeId($asset->getId()); $item->addNodeId($repository->getId()); $log->appendLogWithTypes($item, $formatType, $priorityType); } $repository->deleteAsset($idManager->getId(RequestContext::value('asset_id'))); $harmoni->history->goBack("concerto/asset/delete-return"); }
/** * Get the ids of the assets that match the search criteria * * @param mixed $searchCriteria * @return array * @access public * @since 11/2/04 */ function searchAssets($searchCriteria) { $matchingIds = array(); $recordMgr = Services::getService("RecordManager"); $schemaMgr = Services::getService("SchemaManager"); $repositoryMgr = Services::getService("Repository"); $schema = $schemaMgr->getSchemaByID($searchCriteria['RecordStructureId']->getIdString()); if ($searchCriteria['AuthoritativeValue']->asString() == '__NonMatching__') { $authoritativeValueArray = array(); $recordStructure = $this->_repository->getRecordStructure($searchCriteria['RecordStructureId']); $partStructure = $recordStructure->getPartStructure($searchCriteria['PartStructureId']); $criteria = new FieldValueSearch($searchCriteria['RecordStructureId']->getIdString(), $schema->getFieldLabelFromID($searchCriteria['PartStructureId']->getIdString()), $partStructure->getAuthoritativeValues(), SEARCH_TYPE_NOT_IN_LIST); } else { $criteria = new FieldValueSearch($searchCriteria['RecordStructureId']->getIdString(), $schema->getFieldLabelFromID($searchCriteria['PartStructureId']->getIdString()), $searchCriteria['AuthoritativeValue'], SEARCH_TYPE_EQUALS); } // Get the asset Ids to limit to. $allAssets = $this->_repository->getAssets(); $idStrings = array(); while ($allAssets->hasNext()) { $asset = $allAssets->next(); $id = $asset->getId(); $idStrings[] = $id->getIdString(); } // Run the search $matchingIds = array_unique($recordMgr->getRecordSetIDsBySearch($criteria, $idStrings)); // Ensure uniqueness and convert the ids to id objects. $matchingIds = array_unique($matchingIds); sort($matchingIds); $idManager = Services::getService("Id"); for ($i = 0; $i < count($matchingIds); $i++) { $matchingIds[$i] = $idManager->getId($matchingIds[$i]); } // Return the array return $matchingIds; }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function buildContent() { $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); $repository = $this->getRepository(); // function links ob_start(); print _("Collection") . ": "; RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository); $layout = new Block(ob_get_contents(), 3); ob_end_clean(); $actionRows->add($layout, "100%", null, LEFT, CENTER); $repositoryManager = Services::getService("Repository"); // Get all the types $types = $repository->getAssetTypes(); // put the drs into an array and order them. $typeArray = array(); while ($types->hasNext()) { $type = $types->next(); $typeArray[$type->getDomain() . " " . $type->getAuthority() . " " . $type->getKeyword()] = $type; } ksort($typeArray); // print the Results $resultPrinter = new ArrayResultPrinter($typeArray, 2, 20, "printTypeShort", $repository->getId()); $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px")); $resultLayout = $resultPrinter->getLayout(); $actionRows->add($resultLayout, "100%", null, LEFT, CENTER); }
/** * Create a new PrimitiveIO object that allows for selection from an authority * list * * @param <##> * @return <##> * @access public * @since 5/1/06 */ static function createComponentForPartStructure($partStruct) { ArgumentValidator::validate($partStruct, ExtendsValidatorRule::getRule("PartStructure")); $partStructType = $partStruct->getType(); // get the datamanager data type $dataType = $partStructType->getKeyword(); // printpre($dataType); $authoritativeValues = $partStruct->getAuthoritativeValues(); if ($authoritativeValues->hasNext()) { $authZManager = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify_authority_list"), $partStruct->getRepositoryId())) { $component = new PrimitiveIO_AuthoritativeContainer(); $component->setSelectComponent(PrimitiveIOManager::createAuthoritativeComponent($dataType)); $component->setNewComponent(PrimitiveIOManager::createComponent($dataType)); } else { $component = PrimitiveIOManager::createAuthoritativeComponent($dataType); } while ($authoritativeValues->hasNext()) { $component->addOptionFromSObject($authoritativeValues->next()); } } else { // get the simple component for this data type $component = PrimitiveIOManager::createComponent($dataType); } return $component; }
/** * Initializes the dependency injector */ protected function _initDependencyInjection() { require_once self::GraviDir . '/DependencyInjection/DependencyInjection.php'; require_once self::GraviDir . '/DependencyInjection/Services.php'; require_once self::GraviDir . '/String/String.php'; Services::init(); }
/** * Execute the action * * @return void * @access public * @since 10/9/08 */ public function execute() { header('Content-Type: text/plain;'); try { if (!$this->isAuthorizedToExecute()) { throw new PermissionDeniedException("You must be logged in."); } $mgr = SlotManager::instance(); $slot = $mgr->getSlotByShortname(RequestContext::value('slot')); $slot->makeAlias($mgr->getSlotByShortname(RequestContext::value('target_slot'))); print _("Success"); /********************************************************* * Log the success *********************************************************/ if (Services::serviceRunning("Logging")) { $loggingManager = Services::getService("Logging"); $log = $loggingManager->getLogForWriting("Segue"); $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified."); $priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events."); $item = new AgentNodeEntryItem("Alias Made", "'" . $slot->getShortname() . "' has been made an alias of '" . RequestContext::value('target_slot') . "'."); $item->addNodeId($slot->getSiteId()); $log->appendLogWithTypes($item, $formatType, $priorityType); } } catch (OperationFailedException $e) { print $e->getMessage(); } catch (UnknownIdException $e) { print $e->getMessage(); } exit; }
/** * Answer the tags * * @return object TagIterator * @access public * @since 11/8/06 */ function getTags() { $tagManager = Services::getService("Tagging"); $tags = $tagManager->getTags(TAG_SORT_ALFA, $this->getNumTags()); // printpre($tags); return $tags; }
/** * Retrieve services for an item * * @param stdObject $item * @return array */ public static function get_for_item($item) { Services::$current = $item; $services = array_map(array('Services', 'replace'), Services::$services); $services = array_map(array('Services', 'export'), $services); return $services; }
/** * Returns a block of XHTML-valid code that contains markup for this specific * component. * @param string $fieldName The field name to use when outputting form data or * similar parameters/information. * @access public * @return string */ function getMarkup($fieldName) { ob_start(); if (is_object($this->_id)) { $repositoryManager = Services::getService('Repository'); try { $asset = $repositoryManager->getAsset($this->_id); print "\n<table border='0'>"; print "\n\t<tr>\n\t\t<td>"; $thumbnailURL = RepositoryInputOutputModuleManager::getThumbnailUrlForAsset($this->_id); if ($thumbnailURL !== FALSE) { // print "\n\t<br /><a href='".$assetViewUrl."'>"; print "\n\t\t<img src='{$thumbnailURL}' alt='Thumbnail Image' class='thumbnail_image' />"; // print "\n\t</a>"; } print "\n\t\t</td>\n\t\t</tr>"; print "\n\t<tr>\n\t\t<td>"; print _("Id: ") . $this->_id->getIdString(); print "\n\t\t</td>\n\t\t</tr>"; print "\n\t<tr>\n\t\t<td>"; print _("Name: ") . $asset->getDisplayName(); print "\n\t\t</td>\n\t\t</tr>"; print "\n</table>"; } catch (UnknownIdException $e) { print "\n<div style='margin: 10px; padding: 10px; border: 1px dotted;'>"; print _("The target Asset has been deleted or is no longer available."); print "</div>"; } } $m = ob_get_contents(); ob_end_clean(); return $m; }
/** * Visit a Block * * @param object BlockSiteComponent $siteComponent * @return mixed * @access public * @since 8/31/07 */ public function visitBlock(BlockSiteComponent $siteComponent) { // check to see if user is authorized to view block $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if (!$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view_comments"), $idManager->getId($siteComponent->getId()))) { return; } $harmoni = Harmoni::instance(); //get all comments for site component $commentsManager = CommentManager::instance(); $comments = $commentsManager->getAllComments($siteComponent->getAsset()); while ($comments->hasNext()) { $comment = $comments->next(); $item = $this->addItem(new RSSItem()); $item->setTitle($comment->getSubject()); $item->setLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId())) . "#comment_" . $comment->getIdString(), true); $item->setPubDate($comment->getModificationDate()); $agentMgr = Services::getService("Agent"); $agent = $comment->getAuthor(); $item->setAuthor($agent->getDisplayName()); $item->setCommentsLink(SiteDispatcher::quickURL("view", "html", array("node" => $siteComponent->getId()))); $pluginMgr = Services::getService("PluginManager"); $plugin = $pluginMgr->getPlugin($comment->getAsset()); $item->setDescription($plugin->executeAndGetMarkup()); // MediaFile eclosures. try { foreach ($plugin->getRelatedMediaFiles() as $file) { $item->addEnclosure($file->getUrl(), $file->getSize()->value(), $file->getMimeType()); } } catch (UnimplementedException $e) { } } }
/** * Answer all the tags in Segue by everyon * * @return object TagIterator * @access public * @since 11/8/06 */ function getTags() { $harmoni = Harmoni::instance(); $tagManager = Services::getService("Tagging"); $tags = $tagManager->getTags(TAG_SORT_ALFA, $this->getNumTags()); return $tags; }
public function beforeAction($action) { $criteria = new CDbCriteria(); $criteria->addCondition('status = 1'); $criteria->addCondition('created_by = ' . Yii::app()->user->getInfo()); $this->servicesArray = Services::model()->findAll($criteria); $arrayForSettings = array(); $Settings = Settings::model()->findAll(); foreach ($Settings as $key => $val) { $arrayForSettings[$val->setting_name] = $val->setting_value; } self::$settings = $arrayForSettings; $this->pageTitle = Yii::app()->name; $this->pageName = 'Account'; $this->pageClass = 'blue'; Yii::app()->session['securityCheck'] = md5(ip2long(Yii::app()->request->userHostAddress) + date("Y")); /* @var $cs CClientScript */ $cs = Yii::app()->clientScript; // register jQuery script $cs->registerPackage('jquery'); // register bootstrap script $cs->registerPackage('bootstrap'); // If application is using a theme, replace default layout controller variable that start with '//layouts/' with a theme link if (empty(Yii::app()->theme->name) == false && isset($this->layout) == true && strpos($this->layout, '//layouts/') === 0) { // Replace path with slash by dot. $sThemeLayout = 'webroot.themes.' . Yii::app()->theme->name . '.views.layouts.' . str_replace('/', '.', substr($this->layout, 10)); // If theme override given layout, get it from theme if ($this->getLayoutFile($sThemeLayout) !== false) { $this->layout = $sThemeLayout; } } return true; }
/** * @see lib/modules/CommandModule::execute() */ public function execute($user, $target, $message) { // split message $messageEx = explode(' ', $message); if (count($messageEx) >= 2) { // get channel name $channel = $messageEx[1]; // avoid empty strings if (empty($channel)) { $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint')); } // add the # if ($channel[0] != '#') { $channel = '#' . $channel; } unset($messageEx[0]); unset($messageEx[1]); $message = implode(' ', $messageEx); $this->bot->part($channel, $message); $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success', $channel)); } else { // send syntax hint $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.syntaxHint')); } }
/** * Answer an iterator of the latest assets. * * @return object Iterator * @access public * @since 8/8/06 */ function getAssets() { $authZManager = Services::getService("AuthZ"); $idManager = Services::getService("IdManager"); $assetsByDate = array(); $repositoryManager = Services::getService('Repository'); $repositories = $repositoryManager->getRepositories(); $exhibitionRepositoryType = new Type('System Repositories', 'edu.middlebury.concerto', 'Exhibitions'); while ($repositories->hasNext()) { $repository = $repositories->next(); if (!$exhibitionRepositoryType->isEqual($repository->getType()) && $authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $repository->getId())) { $assets = parent::getAssets($repository); $i = 0; while ($assets->hasNext() && $i < $this->_numInFeed) { $asset = $assets->next(); $assetId = $asset->getId(); if (RequestContext::value('order') == 'modification') { $date = $asset->getModificationDate(); } else { $date = $asset->getCreationDate(); } $j = 0; while (isset($assetsByDate[$date->asString() . " " . $j])) { $j++; } $assetsByDate[$date->asString() . " " . $j] = $asset; $i++; } } } krsort($assetsByDate); $iterator = new HarmoniIterator($assetsByDate); return $iterator; }
/** * Answer the plugin content for a block * * @param object BlockSiteComponent $block * @return string * @access public * @since 1/7/08 */ function getPluginContent($block) { if ($block->getId() != $this->_node->getId()) { return parent::getPluginContent($block); } $harmoni = Harmoni::instance(); $pluginManager = Services::getService('PluginManager'); $plugin = $pluginManager->getPlugin($block->getAsset()); ob_start(); print "\n<form action='" . SiteDispatcher::quickURL('versioning', 'compare_versions', array('node' => SiteDispatcher::getCurrentNodeId())) . "' method='post'>"; print "\n\t<div style='float: right;'>"; print "\n\t<input type='submit' value='" . _("Compare Selected Revisions »") . "'"; if (count($plugin->getVersions()) <= 1) { print " disabled='disabled'"; } print "/>"; print "\n\t</div>"; print "\n\t<div style='float: left;'>\n\t\t<a href='" . $harmoni->history->getReturnURL('view_history_' . $block->getId()) . "'>"; print "\n\t\t\t<input type='button' value='" . _("« Go Back") . "'/>\n\t\t</a>\n\t</div>"; print "\n\t\t<input type='hidden' name='module' value='versioning'/>"; print "\n\t<input type='hidden' name='action' value='compare_versions'/>"; print "\n\t<input type='hidden' name='node' value='" . SiteDispatcher::getCurrentNodeId() . "'/>"; print $this->getVersionTable($plugin); print "\n</form>"; print $this->getVersionChoiceJS(); return ob_get_clean(); }
/** * Add the creator column to the dr_asset_info table. * * @param int $dbIndex * @return void * @access public * @since 10/8/07 */ public static function harmoni_0_12_4_update($dbIndex) { $dbc = Services::getService("DBHandler"); try { $dbc->query(new GenericSQLQuery("DROP INDEX log_entry_timestamp_index"), $dbIndex); printpre("Dropping index 'log_entry_timestamp_index'."); } catch (DatabaseException $e) { // printpre("NOT dropping index 'log_entry_timestamp_index'."); // printpre($e->getMessage()); } try { $dbc->query(new GenericSQLQuery('CREATE INDEX log_entry_format_index ON log_entry (log_name, fk_format_type, fk_priority_type, "timestamp");'), $dbIndex); printpre("Creating index 'log_entry_format_index'."); } catch (DatabaseException $e) { // printpre("NOT creating index 'log_entry_format_index'."); // printpre($e->getMessage()); } try { $dbc->query(new GenericSQLQuery('CREATE INDEX log_agent_fk_entry_index ON log_agent (fk_entry);'), $dbIndex); printpre("Creating index 'log_agent_fk_entry_index'."); } catch (DatabaseException $e) { // printpre("NOT creating index 'log_agent_fk_entry_index'."); // printpre($e->getMessage()); } try { $dbc->query(new GenericSQLQuery('CREATE INDEX log_node_fk_entry_index ON log_node (fk_entry);'), $dbIndex); printpre("Creating index 'log_node_fk_entry_index'."); } catch (DatabaseException $e) { // printpre("NOT creating index 'log_node_fk_entry_index'."); // printpre($e->getMessage()); } }
/** * Constructor * * @param mixed $entryItem * @param object Type $formatType * @param object Type $priorityType * @return object * @access public * @since 3/1/06 */ function HarmoniEntry($timestamp, $category, $description, $backtrace, $agents, $nodes, $formatType, $priorityType) { ArgumentValidator::validate($timestamp, ExtendsValidatorRule::getRule("DateAndTime")); ArgumentValidator::validate($category, StringValidatorRule::getRule()); ArgumentValidator::validate($description, StringValidatorRule::getRule()); ArgumentValidator::validate($backtrace, StringValidatorRule::getRule()); ArgumentValidator::validate($agents, ArrayValidatorRule::getRule()); ArgumentValidator::validate($nodes, ArrayValidatorRule::getRule()); ArgumentValidator::validate($formatType, ExtendsValidatorRule::getRule("Type")); ArgumentValidator::validate($priorityType, ExtendsValidatorRule::getRule("type")); $this->_timestamp = $timestamp; $this->_formatType = $formatType; $this->_priorityType = $priorityType; $this->_entryItem = new AgentNodeEntryItem($category, $description); $this->_entryItem->setBacktrace($backtrace); $idManager = Services::getService("Id"); foreach ($agents as $idString) { if ($idString) { $this->_entryItem->addAgentId($idManager->getId($idString)); } } foreach ($nodes as $idString) { if ($idString) { $this->_entryItem->addNodeId($idManager->getId($idString)); } } }
/** * Build the content for this action * * @return boolean * @access public * @since 4/26/05 */ function buildContent() { $actionRows = $this->getActionRows(); $harmoni = Harmoni::instance(); ob_start(); CollectionsPrinter::printFunctionLinks(); $layout = new Block(ob_get_contents(), STANDARD_BLOCK); ob_end_clean(); $actionRows->add($layout, null, null, CENTER, CENTER); $type = HarmoniType::fromString(urldecode(RequestContext::value('type'))); $repositoryManager = Services::getService("Repository"); // Get the Repositories $allRepositories = $repositoryManager->getRepositoriesByType($type); // put the repositories into an array and order them. // @todo, do authorization checking $repositoryArray = array(); while ($allRepositories->hasNext()) { $repository = $allRepositories->next(); $repositoryArray[$repository->getDisplayName()] = $repository; } ksort($repositoryArray); // print the Results $resultPrinter = new ArrayResultPrinter($repositoryArray, 2, 20, "printrepositoryShort", $harmoni); $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px")); $resultLayout = $resultPrinter->getLayout(); $actionRows->add($resultLayout, null, null, CENTER, CENTER); }
/** * Check Authorizations * * @return boolean * @access public * @since 4/26/05 */ function isAuthorizedToExecute() { // Check that the user can access this collection $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); return $authZ->isUserAuthorizedBelow($idManager->getId("edu.middlebury.authorization.view"), $this->getRepositoryId()); }