本文整理汇总了PHP中KTUtil::meldOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::meldOptions方法的具体用法?PHP KTUtil::meldOptions怎么用?PHP KTUtil::meldOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KTUtil
的用法示例。
在下文中一共展示了KTUtil::meldOptions方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_updateFeed
function do_updateFeed()
{
$iFeedId = KTUtil::arrayGet($_REQUEST, 'feed_id');
$aErrorOptions = array('redirect_to' => array('editFeed', sprintf('feed_id=%s', $iFeedId)));
$sTitle = $this->oValidator->validateString(KTUtil::arrayGet($_REQUEST, 'title'), KTUtil::meldOptions($aErrorOptions, array('message' => _kt("You must provide a title"))));
$sUrl = KTUtil::arrayGet($_REQUEST, 'url');
$res = KTrss::updateFeed($iFeedId, $sTitle, $sUrl);
if (PEAR::isError($res)) {
$this->errorRedirectToMain(sprintf(_kt('Unable to delete item: %s'), $res->getMessage()));
} else {
$this->successRedirectToMain(sprintf(_kt('Updated news item.')));
}
}
示例2: array
function &validatePermissionByName($iId, $aOptions = null)
{
$aOptions = KTUtil::meldOptions($aOptions, array('method' => 'getByName'));
return $this->validateEntity('KTPermission', $iId, $aOptions);
}
示例3: do_createUser
function do_createUser()
{
// FIXME generate and pass the error stack to adduser.
$old_search = KTUtil::arrayGet($_REQUEST, 'old_search');
$aErrorOptions = array('redirect_to' => array('addUser', sprintf('old_search=%s&do_search=1', $old_search)));
$aInputKeys = array('newusername', 'name', 'email_address', 'email_notifications', 'mobile_number', 'max_sessions');
$this->persistParams($aInputKeys);
$username = $this->oValidator->validateString(KTUtil::arrayGet($_REQUEST, 'newusername'), KTUtil::meldOptions($aErrorOptions, array('message' => _kt("You must specify a new username."))));
$name = $this->oValidator->validateString(KTUtil::arrayGet($_REQUEST, 'name'), KTUtil::meldOptions($aErrorOptions, array('message' => _kt("You must provide a name"))));
$email_address = KTUtil::arrayGet($_REQUEST, 'email_address');
$email_notifications = KTUtil::arrayGet($_REQUEST, 'email_notifications', false);
if ($email_notifications !== false) {
$email_notifications = true;
}
$mobile_number = KTUtil::arrayGet($_REQUEST, 'mobile_number');
$max_sessions = $this->oValidator->validateInteger(KTUtil::arrayGet($_REQUEST, 'max_sessions'), KTUtil::meldOptions($aErrorOptions, array('message' => _kt("You must specify a numeric value for maximum sessions."))));
$password = KTUtil::arrayGet($_REQUEST, 'new_password');
$confirm_password = KTUtil::arrayGet($_REQUEST, 'confirm_password');
$KTConfig =& KTConfig::getSingleton();
$minLength = (int) $KTConfig->get('user_prefs/passwordLength', 6);
$restrictAdmin = (bool) $KTConfig->get('user_prefs/restrictAdminPasswords', false);
if ($restrictAdmin && strlen($password) < $minLength) {
$this->errorRedirectTo('addUser', sprintf(_kt("The password must be at least %d characters long."), $minLength), sprintf("old_search=%s&do_search=1", $old_search));
} else {
if (empty($password)) {
$this->errorRedirectTo('addUser', _kt("You must specify a password for the user."), sprintf("old_search=%s&do_search=1", $old_search));
} else {
if ($password !== $confirm_password) {
$this->errorRedirectTo('addUser', _kt("The passwords you specified do not match."), sprintf("old_search=%s&do_search=1", $old_search));
}
}
}
if (preg_match('/[\\!\\$\\#\\%\\^\\&\\*]/', $username)) {
$this->errorRedirectTo('addUser', _kt("You have entered an invalid character in your username."));
}
if (preg_match('/[\\!\\$\\#\\%\\^\\&\\*]/', $name)) {
$this->errorRedirectTo('addUser', _kt("You have entered an invalid character in your name."));
}
$dupUser =& User::getByUserName($username);
if (!PEAR::isError($dupUser)) {
$this->errorRedirectTo('addUser', _kt("A user with that username already exists"));
}
$oUser =& User::createFromArray(array("sUsername" => $username, "sName" => $name, "sPassword" => md5($password), "iQuotaMax" => 0, "iQuotaCurrent" => 0, "sEmail" => $email_address, "bEmailNotification" => $email_notifications, "sMobile" => $mobile_number, "bSmsNotification" => false, "iMaxSessions" => $max_sessions));
if (PEAR::isError($oUser) || $oUser == false) {
$this->errorRedirectToMain(_kt("failed to create user."), sprintf("old_search=%s&do_search=1", $old_search));
exit(0);
}
$this->successRedirectToMain(_kt('Created new user') . ': ' . $oUser->getUsername(), 'name=' . $oUser->getUsername(), sprintf("old_search=%s&do_search=1", $old_search));
}
示例4: array
function &getByTransition($oTransition, $aOptions = null)
{
$iTransitionId = KTUtil::getId($oTransition);
$aOptions = KTUtil::meldOptions($aOptions, array('multi' => true));
return KTEntityUtil::getByDict('KTWorkflowTriggerInstance', array('workflow_transition_id' => $iTransitionId), $aOptions);
}
示例5: array
function &getGenericFieldsets($aOptions = null)
{
$aOptions = KTUtil::meldOptions($aOptions, array('multi' => true));
return KTEntityUtil::getByDict('KTFieldset', array('is_generic' => true, 'disabled' => false), $aOptions);
}
示例6: breadcrumbsForDocument
function breadcrumbsForDocument($oDocument, $aOptions = null, $iFolderId = null)
{
$bFinal = KTUtil::arrayGet($aOptions, 'final', true, false);
$aOptions = KTUtil::meldOptions($aOptions, array('final' => false));
if ($iFolderId == null) {
$iFolderId = $oDocument->getFolderId();
}
$aBreadcrumbs = KTBrowseUtil::breadcrumbsForFolder($iFolderId, $aOptions);
$sAction = KTUtil::arrayGet($aOptions, 'documentaction');
$url = KTUtil::addQueryStringSelf('fDocumentId=' . $oDocument->getId());
if (!empty($sAction)) {
$url = generateControllerUrl($sAction, 'fDocumentId=' . $oDocument->getId());
}
if ($bFinal) {
$aBreadcrumbs[] = array('name' => $oDocument->getName());
} else {
$aBreadcrumbs[] = array('url' => $url, 'name' => $oDocument->getName());
}
return $aBreadcrumbs;
}
示例7: get_graph
function get_graph($oWorkflow)
{
$fontsize = 11.0;
$fontname = "Times-Roman";
$opts = array('fontsize' => $fontsize, 'fontname' => $fontname);
$graph = new Image_GraphViz(true, $opts);
$graph->dotCommand = $this->dotCommand;
// we need all states & transitions
// FIXME do we want guards?
// we want to enable link-editing, and indicate that transitions "converge"
// so we use a temporary "node" for transitions
// we also use a "fake" URL which we catch later
// so we can give good "alt" tags.
$states = KTWorkflowState::getByWorkflow($oWorkflow);
$transitions = KTWorkflowTransition::getByWorkflow($oWorkflow);
$this->state_names = array();
$this->transition_names = array();
$state_opts = array('shape' => 'box', 'fontsize' => $fontsize, 'fontname' => $fontname);
$transition_opts = array('shape' => 'box', 'color' => '#ffffff', 'fontsize' => $fontsize, 'fontname' => $fontname);
$finaltransition_opts = array('color' => '#333333');
$sourcetransition_opts = array('color' => '#999999');
// to make this a little more useful, we want to cascade our output from
// start to end states - this will tend to give a better output.
//
// to do this, we need to order our nodes in terms of "nearness" to the
// initial node.
$processing_nodes = array();
$sorted_ids = array();
$availability = array();
$sources = array();
$destinations = array();
$states = KTUtil::keyArray($states);
$transitions = KTUtil::keyArray($transitions);
foreach ($transitions as $tid => $oTransition) {
$sources[$tid] = KTWorkflowAdminUtil::getSourceStates($oTransition, array('ids' => true));
$destinations[$tid] = $oTransition->getTargetStateId();
foreach ($sources[$tid] as $sourcestateid) {
$av = (array) KTUtil::arrayGet($availability, $sourcestateid, array());
$av[] = $tid;
$availability[$sourcestateid] = $av;
}
}
//var_dump($sources); exit(0);
//var_dump($availability); exit(0);
$processing = array($oWorkflow->getStartStateId());
while (!empty($processing)) {
$active = array_shift($processing);
if (!$processing_nodes[$active]) {
// mark that we've seen this node
$processing_nodes[$active] = true;
$sorted[] = $active;
// now add all reachable nodes to the *end* of the queue.
foreach ((array) $availability[$active] as $tid) {
$next = $destinations[$tid];
if (!$processing_nodes[$next]) {
$processing[] = $next;
}
}
}
//var_dump($processing);
}
//var_dump($sorted); exit(0);
foreach ($sorted as $sid) {
$oState = $states[$sid];
$this->state_names[$oState->getId()] = $oState->getHumanName();
$local_opts = array('URL' => sprintf("s%d", $oState->getId()), 'label' => $oState->getHumanName(), 'color' => '#666666');
if ($oState->getId() == $oWorkflow->getStartStateId()) {
$local_opts['color'] = '#000000';
$local_opts['style'] = 'filled';
$local_opts['fillcolor'] = '#cccccc';
}
$graph->addNode(sprintf('state%d', $oState->getId()), KTUtil::meldOptions($state_opts, $local_opts));
}
foreach ($transitions as $tid => $oTransition) {
$name = sprintf('transition%d', $tid);
$this->transition_names[$oTransition->getId()] = $oTransition->getHumanName();
// we "cheat" and use
$graph->addNode($name, KTUtil::meldOptions($transition_opts, array('URL' => sprintf("t%d", $tid), 'label' => $oTransition->getHumanName())));
$dest = sprintf("state%d", $oTransition->getTargetStateId());
$graph->addEdge(array($name => $dest), $finaltransition_opts);
foreach ($sources[$tid] as $source_id) {
$source_name = sprintf("state%d", $source_id);
$graph->addEdge(array($source_name => $name), $sourcetransition_opts);
}
}
// some simple analysis
$errors = array();
$info = array();
$sourceless_transitions = array();
foreach ($transitions as $tid => $oTransition) {
if (empty($sources[$tid])) {
$sourceless_transitions[] = $oTransition->getHumanName();
}
}
if (!empty($sourceless_transitions)) {
$errors[] = sprintf(_kt("Some transitions have no source states: %s"), implode(', ', $sourceless_transitions));
}
$unlinked_states = array();
foreach ($states as $sid => $oState) {
if (!$processing_nodes[$sid]) {
//.........这里部分代码省略.........
示例8: getLastLogins
function getLastLogins($aOptions = null)
{
$oUser = KTUtil::arrayGet($aOptions, 'user');
if ($oUser) {
$iUserId = KTUtil::getId($oUser);
} else {
$iUserId = null;
}
$aOptions = KTUtil::meldOptions(array('limit' => 5, 'orderby' => 'datetime DESC'), $aOptions);
$sTable = KTUserHistory::_table();
if ($iUserId) {
return KTEntityUtil::getByDict($sTable, array('user_id' => $iUserId), $aOptions);
} else {
return KTEntityUtil::getList2('KTUserHistory', null, $aOptions);
}
}
示例9: array
function &getByDocument($oDocument, $aOptions = null)
{
$aOptions = KTUtil::meldOptions(array('multi' => true), $aOptions);
$iDocumentId = KTUtil::getId($oDocument);
return KTEntityUtil::getByDict('KTDocumentContentVersion', array('document_id' => $iDocumentId), $aOptions);
}
示例10: array
function &getByUser($oFolder, $aOptions = null)
{
$aOptions = KTUtil::meldOptions(array('multi' => true), $aOptions);
$iFolderId = KTUtil::getId($oFolder);
return KTEntityUtil::getByDict('KTFolderTransaction', array('folder_id' => $iFolderId), $aOptions);
}