Esempio n. 1
0
// Validate form
if ($form->validate()) {
    $check = Security::check_token('post');
    if ($check) {
        $values = $form->exportValues();
        $picture_element = $form->getElement('picture');
        $picture = $picture_element->getValue();
        $picture_uri = '';
        $name = $values['name'];
        $description = $values['description'];
        $url = $values['url'];
        $status = intval($values['visibility']);
        $picture = $_FILES['picture'];
        $parent_group_id = intval($values['parent_group']);
        $group_id = GroupPortalManager::add($name, $description, $url, $status);
        GroupPortalManager::set_parent_group($group_id, $parent_group_id);
        if (!empty($picture['name'])) {
            $picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
            GroupPortalManager::update($group_id, $name, $description, $url, $status, $picture_uri);
        }
        //@todo send emails
        /*		if (!empty($email) && $send_mail) {
        			$recipient_name = api_get_person_name($firstname, $lastname, null, PERSON_NAME_EMAIL_ADDRESS);
        			$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
        
        			$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
        			$email_admin = api_get_setting('emailAdministrator');
        
        			if ($_configuration['multiple_access_urls']) {
        				$access_url_id = api_get_current_access_url_id();
        				if ($access_url_id != -1) {