/** * Apply the content sorting method. * * @param SiteComponent $siteComponent * @return void * @access public * @since 1/10/08 */ public function applySortMethod(SiteComponent $siteComponent) { if (RequestContext::value('sortMethod') && RequestContext::value('sortMethod') !== $siteComponent->sortMethodSetting()) { $siteComponent->updateSortMethodSetting(RequestContext::value('sortMethod')); } }
/** * Print sort order controls for flow organizers. * * @param SiteComponent $siteComponent * @return void * @access public * @since 4/17/06 */ function printSortMethod($siteComponent, $step) { $property = $step->addComponent("sort_method", new WSelectList()); $methods = array('default' => _('use default'), 'custom' => _('Override - Custom'), 'title_asc' => _('Override - Alphabetic by Title - Ascending'), 'title_desc' => _('Override - Alphabetic by Title - Descending'), 'create_date_asc' => _("Override - Chronologically by Create Date - Ascending"), 'create_date_desc' => _("Override - Chronologically by Create Date - Descending"), 'mod_date_asc' => _("Override - Chronologically by Modification Date - Ascending"), 'mod_date_desc' => _("Override - Chronologically by Modification Date - Descending")); foreach ($methods as $method => $display) { $property->addOption($method, $display); } if ($siteComponent) { $property->setValue($siteComponent->sortMethodSetting()); $parent = $siteComponent->getParentComponent(); } else { $parent = null; } print "\n<p><strong>" . _("Content Sort Method:") . "</strong> "; print "\n[[sort_method]]"; if ($parent) { print "\n<br/>" . str_replace('%1', $parent->sortMethod(), _("Current default setting: %1")); } print "\n<br/><span style='font-size: smaller;'>"; print _("This setting will change how 'content containers' sort their content. The 'custom' setting allows manual arrangement."); print "</span>"; print "\n</p>"; }
/** * Print the sort method controls for flow organizers * * @param SiteComponent $siteComponent * @param optional boolean $isSite default false * @return void * @access public * @since 1/10/08 */ public function printSortMethod(SiteComponent $siteComponent, $isSite = false) { print "\n\t\t\t\t<tr><td class='ui2_settingborder'>"; print "\n\t\t\t\t<div class='ui2_settingtitle'>"; print _('Sort: ') . "\n\t\t\t\t</div>"; print "\n\t\t\t\t</td><td class='ui2_settingborder'>"; $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $siteComponent->getQualifierId())) { $canEdit = true; } else { $canEdit = false; } $methods = array('custom' => _('Custom'), 'title_asc' => _('Title: A-Z'), 'title_desc' => _('Title: Z-A'), 'create_date_asc' => _("Creation Date: Recent Last"), 'create_date_desc' => _("Creation Date: Recent First"), 'mod_date_asc' => _("Modification Date: Recent Last"), 'mod_date_desc' => _("Modification Date: Recent First")); print "\n\t\t\t\t\t<select class='ui2_field'"; print $canEdit ? "" : " disabled='disabled'"; print " name='" . RequestContext::name('sortMethod') . "'>"; $parent = $siteComponent->getParentComponent(); // if not site setting (i.e. root node of site), the include default option if (!$isSite) { print "\n\t\t\t\t\t\t<option value='default'"; if ($siteComponent->sortMethodSetting() === 'default') { print " selected='selected'>"; } else { print ">"; } print _("default"); $parent = $siteComponent->getParentComponent(); if ($parent) { print " (" . _("current") . ": "; foreach ($methods as $method => $display) { if ($parent->sortMethod() == $method) { print $display; } } print ")"; } print "</option>"; } // other setting select option foreach ($methods as $method => $display) { print "\n\t\t\t\t\t\t<option value='" . $method . "'"; if ($siteComponent->sortMethodSetting() === $method) { print " selected='selected'"; } print ">"; print $display; print "</option>"; } print "\n\t\t\t\t\t</select><br/> "; // print out default settings // $parent = $siteComponent->getParentComponent(); // if ($parent) { // print "\n<span class='ui2_text'>("._("default").": "; // print $methods[$parent->sortMethod()]; // print ")</span>"; // } print "\n\t\t\t\t</td></tr>"; }