?> </ul> </div> <div class="col-md-4"> <h4><?php echo $tr->__("Categories"); ?> :</h4> <ul class="list-group"> <?php foreach ($course->getCategories() as $catId) { $catName = isIdCategoryWpExist($catId); echo "<li class='list-group-item'>" . $catName->name . "</li>"; } ?> </ul> </div> <?php if (AbstractActivityManager::isBuddyPressActive()) { ?> <div class="col-md-4"> <h4><?php echo $tr->__("Groups BuddyPress");
$v2->addSource($_POST['course']['users']); foreach ($_POST['course']['users'] as $key => $value) { if (preg_match('/^[0-9]{1,}$/', $key)) { $v2->addRule($key . "", 'numeric', true, 1, 200, true); } } } $v1->run(); $v2->run(); if (sizeof($v1->errors) > 0 || sizeof($v2->errors)) { $error_course_add = $v1->getMessageErrors() . "<br/>"; $error_course_add .= $v2->getMessageErrors(); } else { $cats = array(); foreach ($v1->sanitized as $key => $value) { if (preg_match('/^[0-9]{1,}$/', $key) && isIdCategoryWpExist($value)) { $cats[] = $value; } } $users = array(); foreach ($v2->sanitized as $key => $authorId) { if (preg_match('/^[0-9]{1,}$/', $key) && StudyPressUserWP::exist($authorId)) { $users[] = $authorId; } } if ($cats) { if ($users) { $managerCourse->add(new Course(array('name' => $v1->sanitized['name'], 'description' => $v1->sanitized['desc'], 'pictureId' => isset($v1->sanitized['pictureId']) ? $v1->sanitized['pictureId'] : '', 'categories' => $cats, 'authors' => $users))); } else { $error_course_add = $tr->__("Please select at least one author"); }
public function getStringCategories() { global $tr; if (!count($this->_categories)) { $allName[] = $tr->__("None"); } else { foreach ($this->_categories as $key => $value) { $nameCat = isIdCategoryWpExist($value); $allName[] = $nameCat->name; } } return implode(", ", $allName); }