本文整理汇总了PHP中CArrayList::getItem方法的典型用法代码示例。如果您正苦于以下问题:PHP CArrayList::getItem方法的具体用法?PHP CArrayList::getItem怎么用?PHP CArrayList::getItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArrayList
的用法示例。
在下文中一共展示了CArrayList::getItem方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTitle
/**
* Название значения показателя
*
* @return mixed
*/
public function getTitle()
{
if ($this->isFromTaxonomy()) {
if (!is_null($this->parentIndex)) {
$manager = $this->parentIndex->manager_class;
$method = $this->parentIndex->manager_method;
if ($manager != "" && $method != "") {
$list = new CArrayList();
$str = '$list = ' . $manager . '::' . $method . ';';
eval($str);
$value = $list->getItem($this->title);
if (!is_null($value)) {
return $value->getValue();
}
}
}
} else {
return $this->title;
}
}
示例2: getTerm
/**
* Ищет термин в указанной таксономии. Если не находит - создает
*
* @param $taxonomy
* @param $key
* @return CTerm
*/
private function getTerm($taxonomyName, $key)
{
if ($taxonomyName == "education_form") {
$forms = new CArrayList();
/**
* Пересортируем формы обучения в другом порядке, чтобы ключом
* было название
*/
foreach (CTaxonomyManager::getCacheEducationForms()->getItems() as $form) {
$forms->add(mb_strtolower($form->getValue()), $form);
}
if ($forms->hasElement(mb_strtolower($key))) {
$term = $forms->getItem(mb_strtolower($key));
} else {
$term = new CTerm();
$term->setTable(TABLE_EDUCATION_FORMS);
$term->setValue($key);
$term->save();
CTaxonomyManager::getCacheEducationForms()->add($term->getId(), $term);
}
} elseif ($taxonomyName == "gender") {
$genders = new CArrayList();
foreach (CTaxonomyManager::getCacheGenders()->getItems() as $gender) {
$genders->add(mb_strtoupper($gender->getValue()), $gender);
}
if ($genders->hasElement(mb_strtoupper($key))) {
$term = $genders->getItem(mb_strtoupper($key));
}
} else {
$taxonomy = CTaxonomyManager::getTaxonomy($taxonomyName);
$term = $taxonomy->getTerm($key);
if (is_null($term)) {
$term = new CTerm();
$term->taxonomy_id = $taxonomy->getId();
$term->setValue($key);
$term->save();
$taxonomy->addTerm($term);
}
}
return $term;
}
示例3: getIndPlansByYears
/**
* @param $restrict
* @return CArrayList
*/
public function getIndPlansByYears($restrict = 0)
{
$result = new CArrayList();
foreach ($this->loads->getItems() as $load) {
$year = new CArrayList();
if ($result->hasElement($load->year_id)) {
$year = $result->getItem($load->year_id);
}
$year->add($load->getId(), $load);
$result->add($load->year_id, $year);
}
/**
* Если есть ограничение, то все, которые под него не попадают
* исключаем из результатов
*/
if ($restrict > 0) {
foreach ($result->getItems() as $year => $load) {
if ($year != $restrict) {
$result->removeItem($year);
}
}
}
return $result;
}
示例4: getLabWorks
/**
* Все лабораторные работы, сгруппированные по семестрам
*
* @return CArrayList
*/
public function getLabWorks()
{
$labs = new CArrayList();
/**
* @var $module CWorkPlanContentModule
* @var $section CWorkPlanContentSection
* @var $load CWorkPlanContentSectionLoad
* @var $topic CWorkPlanContentSectionLoadTopic
*/
$loads = new CArrayList();
foreach ($this->modules->getItems() as $module) {
foreach ($module->sections->getItems() as $section) {
foreach ($section->loads->getItems() as $load) {
if ($load->loadType->getAlias() == "labwork") {
if ($load->topics->getCount() > 0) {
$loads->add($load->getId(), $load);
}
}
}
}
}
foreach ($loads as $load) {
$term_id = $load->term_id;
$termData = new CArrayList();
if ($labs->hasElement($term_id)) {
$termData = $labs->getItem($term_id);
}
foreach ($load->topics->getItems() as $topic) {
$termData->add($topic->getId(), $topic);
}
$labs->add($term_id, $termData);
}
return $labs;
}
示例5: getFilter
/**
* Получить значение фильтра
*
* @param $name
* @return null|int
*/
public static function getFilter($name)
{
$filters = new CArrayList();
foreach (explode("_", CRequest::getString("filter")) as $filter) {
$values = explode(":", $filter);
if (count($values) > 1) {
if ($values[1] != 0) {
$filters->add($values[0], $values[1]);
}
}
}
return $filters->getItem($name);
}
示例6: actionTasks
public function actionTasks()
{
$roles = new CArrayList();
foreach (CSession::getCurrentUser()->getRoles()->getItems() as $role) {
if ($role->hidden != 1) {
$roles->add($role->getId(), $role);
}
}
$sort = new CArrayList();
foreach ($roles->getItems() as $i) {
$sort->add($i->name, $i->getId());
}
$tasks = new CArrayList();
foreach ($sort->getSortedByKey(true)->getItems() as $i) {
$item = $roles->getItem($i);
$tasks->add($item->getId(), $item);
}
$this->setData("tasks", $tasks);
$this->renderView("_dashboard/tasks.tpl");
}