本文整理汇总了PHP中ArrayAdapter::arr方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayAdapter::arr方法的具体用法?PHP ArrayAdapter::arr怎么用?PHP ArrayAdapter::arr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayAdapter
的用法示例。
在下文中一共展示了ArrayAdapter::arr方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeImpl
protected function executeImpl(ArrayAdapter $params)
{
$action = $params->str('action');
$gallery = $params->str('gallery');
switch ($action) {
case 'creategall':
PsGallery::makeNew($gallery, $params->str('name'));
break;
case 'save':
PsGallery::inst($gallery)->saveGallery($params->str('name'), $params->arr('images'));
break;
case 'imgadd':
PsGallery::inst($gallery)->addWebImg($params->arr('img'));
break;
case 'imgdel':
if ($params->bool('web')) {
PsGallery::inst($gallery)->deleteWebImg($params->str('file'));
} else {
PsGallery::inst($gallery)->deleteLocalImg($params->str('file'));
}
break;
default:
json_error("Unknown action [{$action}].");
}
return new AjaxSuccess();
}
示例2: executeImpl
protected function executeImpl(ArrayAdapter $params)
{
$testingId = $params->int('id');
$tasks = $params->arr('tasks');
$time = $params->int('time');
TestingManager::getInstance()->updateTestingResults($testingId, $time, $tasks);
$pointsGiven = PL_testing::inst()->givePoints(PsUser::inst(), $testingId);
return new AjaxSuccess($pointsGiven);
}
示例3: executeImpl
protected function executeImpl(ArrayAdapter $params)
{
$libType = $params->str('fsubtype');
$libManager = Handlers::getInstance()->getLibManager($libType);
$models = $params->arr('models');
foreach ($models as $model) {
$model['grup'] = $libType;
$item = new LibItemDb($model);
check_condition($item->getIdent(), 'Не передан идентификатор сущности');
$libManager->saveLibItem($item, AdminLibBean::inst());
}
return new AjaxSuccess();
}
示例4: executeImpl
protected function executeImpl(ArrayAdapter $params)
{
$action = $params->str('action');
$unique = $params->str('unique');
$folding = Handlers::getInstance()->getFoldingByUnique($unique);
$res = 'OK';
switch ($action) {
case 'save_list':
$list = $params->str('list');
$data = $params->arr('data');
$folding->saveList($list, $data);
break;
default:
return 'Неизвестное действие: ' . $action;
}
return new AjaxSuccess($res);
}
示例5: executeImpl
protected function executeImpl(ArrayAdapter $params)
{
$action = $params->str('action');
$mhash = $params->str('mhash');
$lident = $params->str('lident');
$ridents = $params->arr('ridents');
$CONTROLLER = AdminMappings::inst();
$result = 'OK';
switch ($action) {
case 'load_left':
$mapping = $CONTROLLER->getMapping($mhash);
$result = array();
$result['lsrc'] = $mapping->getDescriptionLsrc();
$result['rsrc'] = $mapping->getDescriptionRsrc();
$result['lidents'] = array();
foreach ($mapping->getIdentsLeft() as $lident) {
$result['lidents'][] = array($lident, count($mapping->getMappedEntitysUnsafe($lident)));
}
break;
case 'load_right':
$mapping = $CONTROLLER->getMapping($mhash);
$ridents = $mapping->getIdentsRight($lident);
$selected = $mapping->getMappedEntitysUnsafe($lident);
$notSelected = array_diff($ridents, $selected);
$result = array();
foreach ($selected as $ident) {
$result[] = array($ident, 1, in_array($ident, $ridents));
}
foreach ($notSelected as $ident) {
$result[] = array($ident, 0, true);
}
break;
case 'save':
$CONTROLLER->saveMapping($mhash, $lident, $ridents);
break;
case 'clean':
$CONTROLLER->cleanMapping($mhash);
break;
default:
return 'Неизвестное действие: ' . $action;
}
return new AjaxSuccess($result);
}
示例6: makeNewFolding
/**
* Метод создаёт новый фолдинг
*/
public function makeNewFolding(ArrayAdapter $adapter)
{
$ifaces = $adapter->arr('ifaces');
$rtypes = $adapter->arr('rtypes');
$type = lowertrim($adapter->str('FoldingType'));
$subtype = lowertrim($adapter->str('FoldingSubType'));
$group = $adapter->str('FoldingGroup');
$classPrefix = $adapter->str('FoldingClassPrefix');
check_condition($type, 'Не передан тип фолдинга');
check_condition($group, 'Не передана группа для фолдинга');
check_condition($classPrefix, 'Не передан префикс для классов фолдинга');
//TODO - определять директорию для воздания менеджера фолдингов.
die('Folding dir is not deffined.');
$classesDi = DirItem::inst(array('sdk/kit', 'folded'), $group);
check_condition(!$classesDi->isDir(), "Директория {$classesDi} уже существует");
check_condition(!$classesDi->isFile(), "Элемент {$classesDi} не может быть файлом");
$rtypes = array_intersect(array_keys(PsUtil::getClassConsts('FoldedResources', 'RTYPE_')), $rtypes);
$rtypesArr = trim(implode(', self::', $rtypes));
$rtypesArr = $rtypesArr ? "self::{$rtypesArr}" : '';
$hasPhp = in_array('RTYPE_PHP', $rtypes);
$classesDm = DirManager::inst($classesDi->getRelPath())->makePath();
$resourcesPatternDmTo = DirManager::resources(array('folded', $group, FoldedResources::PATTERN_NAME));
check_condition(!$resourcesPatternDmTo->isDir(), "Целевая директория {$resourcesPatternDmTo} существует");
$resourcesPatternDmFrom = DirManager::resources(array('folded', FoldedResources::PATTERN_NAME));
check_condition($resourcesPatternDmFrom->isDir(), "Некорректна директория-источник {$resourcesPatternDmFrom}");
$interfaces = array();
foreach ($this->getFoldedInterfaces($ifaces) as $name => $ifaceClass) {
$ctt = $ifaceClass->getClassBody();
if ($ctt) {
$interfaces[] = "/****************\n\t * {$name}\n\t ****************/\n" . $ctt;
}
}
$smParams = $adapter->getData();
$smParams['rtypes'] = $rtypesArr;
$smParams['funique'] = FoldedResources::unique($type, $subtype);
$smParams['BaseClass'] = 'Base' . $classPrefix;
$smParams['ManagerClass'] = $classPrefix . 'Manager';
$smParams['ResourcesClass'] = $classPrefix . 'Resources';
$smParams['implements'] = $ifaces ? 'implements ' . implode(', ', $ifaces) . ' ' : '';
$smParams['interfaces'] = $interfaces ? implode("\n\n\t", $interfaces) : '';
try {
//КЛАССЫ
//Resources
$tpl = PSSmarty::template(DirItem::inst(array(__DIR__, 'tpls'), 'resources.tpl'), $smParams);
$di = $classesDm->getDirItem(null, $smParams['ResourcesClass'], 'php');
$di->writeToFile(trim($tpl->fetch()), true);
//Manager
$tpl = PSSmarty::template(DirItem::inst(array(__DIR__, 'tpls'), 'manager.tpl'), $smParams);
$di = $classesDm->getDirItem(null, $smParams['ManagerClass'], 'php');
$di->writeToFile(trim($tpl->fetch()), true);
if ($hasPhp) {
//BaseClass
$tpl = PSSmarty::template(DirItem::inst(array(__DIR__, 'tpls'), 'baseclass.tpl'), $smParams);
$di = $classesDm->getDirItem(null, $smParams['BaseClass'], 'php');
$di->writeToFile(trim($tpl->fetch()), true);
}
//ШАБЛОН ДЛЯ СУЩНОСТЕЙ
$resourcesPatternDmTo->makePath();
foreach ($rtypes as $rtype) {
$ext = FoldedResources::resourceTypeToExt(PsUtil::newReflectionClass('FoldedResources')->getConstant($rtype));
$diTo = $resourcesPatternDmTo->getDirItem(null, FoldedResources::PATTERN_NAME, $ext);
$diFrom = $resourcesPatternDmFrom->getDirItem(null, FoldedResources::PATTERN_NAME, $ext);
if ($ext == PsConst::EXT_PHP) {
$diTo->writeToFile(str_replace('eclassnamebase', $smParams['BaseClass'], $diFrom->getFileContents()));
continue;
}
$diFrom->copyTo($diTo);
}
} catch (Exception $ex) {
$classesDm->clearDir(null, true);
$resourcesPatternDmTo->clearDir(null, true);
throw $ex;
}
}
示例7: givePointsByRequest
public function givePointsByRequest(GivePointsContext $ctxt, ArrayAdapter $request)
{
$this->givePointsImpl($ctxt, $request->arr('hodes'));
}
示例8: executeImpl
protected function executeImpl(ArrayAdapter $params)
{
$APM = AdminPagesManager::getInstance();
$APM->saveLayout($params->arr('menu'));
return new AjaxSuccess($APM->getLayout());
}
示例9: executeImpl
protected function executeImpl(ArrayAdapter $params)
{
$items = $params->arr('states');
$res = PopupPagesManager::inst()->updateCurrentUserPagesOrder($items);
return $res === true ? new AjaxSuccess() : $res;
}
示例10: executeImpl
protected function executeImpl(ArrayAdapter $params)
{
$states = $params->arr('states');
$newsLine = NewsManager::getInstance()->getNewsLine($states);
return new AjaxSuccess($newsLine);
}
示例11: executeImpl
protected function executeImpl(ArrayAdapter $params)
{
PsGlobals::inst()->updateProps($params->arr('globals'));
return new AjaxSuccess();
}