Resizing the date range of Calendar Item Event or Updating the dates of the Item event
@param array $postValues, this containing the calendar id, date start, date end

@return Array
197413
public function reschedCalendarEvent($postValues)
	{
	    $responseData = array();
	    
	    $calendarTable = $this->getServiceLocator()->get('MelisCalendarTable');
	    
	    $melisCoreAuth = $this->getServiceLocator()->get('MelisCoreAuth');
	    $userAuthDatas =  $melisCoreAuth->getStorage()->read();
	    $userId = (int) $userAuthDatas->usr_id;
	    
	    $resultEvent = $calendarTable->getEntryById($postValues['cal_id']);
	     
	    if (!empty($resultEvent)){
	         
	        $event = $resultEvent->current();
	         
	        if (!empty($event)){
	            if ($postValues['cal_date_end']==''){
	                $postValues['cal_date_end'] = $postValues['cal_date_start'];
	            }
	            $postValues['cal_last_update_by'] = $userId;
	            $postValues['cal_date_last_update'] = date('Y-m-d H:i:s');
	            $calendarTable->save($postValues,$postValues['cal_id']);
	            $responseData['success'] = 1;
	        }
	    }
	    
	    return $responseData;
	}
617737
public function queryValue($params = array())
    {
        $this->mergeParams($params);
        $this->beginQuery();
        $rst = $this->statement->fetchColumn();
        $this->statement->closeCursor();

        return $rst;
    }
992861
protected function prepare_data(array $postids) {
        global $DB;

        if (empty($postids)) {
            return;
        }

        list($in, $params) = $DB->get_in_or_equal(array_values($postids));
        $sql = "SELECT p.*, f.id AS forum, f.course
                  FROM {forum_posts} p
            INNER JOIN {forum_discussions} d ON d.id = p.discussion
            INNER JOIN {forum} f ON f.id = d.forum
                 WHERE p.id {$in}";

        $posts = $DB->get_recordset_sql($sql, $params);
        $discussionids = [];
        $forumids = [];
        $courseids = [];
        $userids = [];
        foreach ($posts as $post) {
            $discussionids[] = $post->discussion;
            $forumids[] = $post->forum;
            $courseids[] = $post->course;
            $userids[] = $post->userid;
            unset($post->forum);
            if (!isset($this->posts[$post->discussion])) {
                $this->posts[$post->discussion] = [];
            }
            $this->posts[$post->discussion][$post->id] = $post;
        }
        $posts->close();

        if (empty($discussionids)) {
            // All posts have been removed since the task was queued.
            return;
        }

        // Fetch all discussions.
        list($in, $params) = $DB->get_in_or_equal(array_values($discussionids));
        $this->discussions = $DB->get_records_select('forum_discussions', "id {$in}", $params);
        foreach ($this->discussions as $discussion) {
            if (empty($this->forumdiscussions[$discussion->forum])) {
                $this->forumdiscussions[$discussion->forum] = [];
            }
            $this->forumdiscussions[$discussion->forum][] = $discussion->id;
        }

        // Fetch all forums.
        list($in, $params) = $DB->get_in_or_equal(array_values($forumids));
        $this->forums = $DB->get_records_select('forum', "id {$in}", $params);
        foreach ($this->forums as $forum) {
            if (empty($this->courseforums[$forum->course])) {
                $this->courseforums[$forum->course] = [];
            }
            $this->courseforums[$forum->course][] = $forum->id;
        }

        // Fetch all courses.
        list($in, $params) = $DB->get_in_or_equal(array_values($courseids));
        $this->courses = $DB->get_records_select('course', "id $in", $params);

        // Fetch all authors.
        list($in, $params) = $DB->get_in_or_equal(array_values($userids));
        $users = $DB->get_recordset_select('user', "id $in", $params);
        foreach ($users as $user) {
            $this->minimise_user_record($user);
            $this->users[$user->id] = $user;
        }
        $users->close();

        // Fill subscription caches for each forum.
        // These are per-user.
        foreach (array_values($forumids) as $id) {
            \mod_forum\subscriptions::fill_subscription_cache($id);
            \mod_forum\subscriptions::fill_discussion_subscription_cache($id);
        }
    }
812218
public static function createFileFromPostValues($postValues, $filename)
    {
        $fileObject = new \stdClass();
        $fileObject->file = $filename;
        $fileObject->type = $postValues['type'];
        $fileObject->size = $postValues['size'];

        return new File($fileObject);
    }
517453
protected function saveAdvProperty($propertyValues)
    {
        // might break using hard
        $range = array();
        foreach($propertyValues as $key => $value){
            if(is_array($value)){
                // set the range
                foreach($value as $v){
                    $range[] = $this->getClass(tao_helpers_Uri::decode($v));
                }
            }
            else{
                $values[tao_helpers_Uri::decode($key)] = tao_helpers_Uri::decode($value);
            }

        }
        //if label is empty
        $validator = new tao_helpers_form_validators_NotEmpty(array('message' => __('Property\'s label field is required')));
        if(!$validator->evaluate($values[OntologyRdfs::RDFS_LABEL])){
            throw new Exception($validator->getMessage());
        }

        $property = $this->getProperty($values['uri']);
        unset($values['uri']);
        $property->removePropertyValues($this->getProperty(OntologyRdfs::RDFS_RANGE));
        if(!empty($range)){
            foreach($range as $r){
                $property->setRange($r);
            }
        }
        $this->bindProperties($property, $values);
    }
145432
public static function createImageSetFromPostValues($postValues)
    {
        if (isset($postValues['title'], $postValues['width'], $postValues['height'], $postValues['method'])) {
            $imageSetObject = new \stdClass();

            $imageSetObject->title = $postValues['title'];
            $imageSetObject->slug = StringUtil::slugify($postValues['title']);
            $imageSetObject->width = $postValues['width'];
            $imageSetObject->height = $postValues['height'];
            $imageSetObject->method = $postValues['method'];

            return $imageSetObject;
        } else {
            throw new \Exception('Trying to create image set with invalid data.');
        }
    }
729005
protected static function createProperty(array $propertyValues)
    {
        return array_map(
            function($propertyValue) {
                if (is_array($propertyValue)) {
                    return isset($propertyValue['type']) ?
                        self::createItem($propertyValue) : self::tagLanguage($propertyValue);
                }

                return $propertyValue;
            },
            $propertyValues
        );
    }
1126749
protected function getBindingsMergedWithValues(array $values)
    {
        $bindings = [];

        foreach ($values as $key => $value)
        {
            $bindings[$key .'_update'] = $value;
        }

        return array_merge($this->getBindings(), $bindings);
    }
1361557
public function getPostedValues()
    {
        $result = $_POST;
        $result = $this->alterPostedValues($result);
        unset($result[static::Meta]);
        return $result;
    }
649336
protected function get_post_values($ids){
		$data=array(); 
		for ($i=0; $i < sizeof($ids); $i++)
			$data[$ids[$i]]=array();
		
		foreach ($_POST as $key => $value) {
			$details=explode("_",$key,2);
			if (sizeof($details)==1) continue;
			
			$name=$this->name_data($details[1]);
			$data[$details[0]][$name]=ConnectorSecurity::filter($value);
		}
			
		return $data;
	}
1370691
public function toArray($notEmptyValues = false)
    {
        $props = $this->getReflection()->getProperties();
        if ($this->getReflection()->getParentClass()) {
            $temp = $this->getReflection()->getParentClass()->getProperties();
            $props = array_merge($props, $temp);
        }

        if (strpos($this->getReflection()->getName(), '__CG__') !== FALSE) {
            $props = $this->getReflection()->getParentClass()->getProperties();
        }

        $array = array();
        foreach ($props as $prop) {
            $getter = 'get'.ucfirst($prop->getName());

            if (method_exists($this, $getter)) {
                $empty = $this->$getter();
                $empty = is_null($empty) || empty($empty);

                if (!is_object($this->$getter())) {
                    if (($notEmptyValues && !$empty) || !$empty) {
                        $array[$prop->getName()] = $this->$getter();
                    }
                } elseif (is_object($this->$getter())) {
                    if (method_exists($this->$getter(), 'getId')) {
                        $array[$prop->getName()] = $this->$getter()->getId();
                    } elseif ($this->$getter() instanceof \DateTime) {
                        $array[$prop->getName()] = $this->$getter()->format('d.m.Y');
                    } elseif ($this->$getter() instanceof \Doctrine\Common\Collections\Collection) {
                        $tmp = array();
                        foreach ($this->$getter() as $item) {
                            $tmp[] = $item->getId();
                        }

                        $array[$prop->getName()] = $tmp;
                    }
                }
            }
        }

        return $array;
    }
625720
public function prepareBindingsForUpdate(array $bindings, array $values)
    {
        $values = collect($values)->map(function ($value, $column) {
            return $this->isJsonSelector($column) && ! $this->isExpression($value)
                ? json_encode($value)
                : $value;
        })->all();

        // Update statements with "joins" in Postgres use an interesting syntax. We need to
        // take all of the bindings and put them on the end of this array since they are
        // added to the end of the "where" clause statements as typical where clauses.
        $bindingsWithoutJoin = Arr::except($bindings, 'join');

        return array_values(
            array_merge($values, $bindings['join'], Arr::flatten($bindingsWithoutJoin))
        );
    }
588605
public function postProcessFormValues(array $formValues)
    {
        $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.driver', $formValues['driver']);
        $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.dbname', $formValues['dbname']);
        $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.user', $formValues['user']);
        $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.password', $formValues['password']);
        $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.host', $formValues['host']);
        // Postgres natively supports multibyte-UTF8. It does not know utf8mb4, which is the default now
        if ($formValues['driver'] === 'pdo_pgsql') {
            $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'Neos.Flow.persistence.backendOptions.charset', 'utf8');
        }
        $this->configurationSource->save(FLOW_PATH_CONFIGURATION . ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $this->distributionSettings);

        $this->configurationManager->refreshConfiguration();

        $settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow');
        $connectionSettings = $settings['persistence']['backendOptions'];
        try {
            $this->connectToDatabase($connectionSettings);
        } catch (\Exception $exception) {
            if (!$exception instanceof DBALException && !$exception instanceof \PDOException) {
                throw $exception;
            }
            try {
                $this->createDatabase($connectionSettings, $formValues['dbname']);
            } catch (DBALException $exception) {
                throw new SetupException(sprintf('Database "%s" could not be created. Please check the permissions for user "%s". DBAL Exception: "%s"', $formValues['dbname'], $formValues['user'], $exception->getMessage()), 1351000841, $exception);
            } catch (\PDOException $exception) {
                throw new SetupException(sprintf('Database "%s" could not be created. Please check the permissions for user "%s". PDO Exception: "%s"', $formValues['dbname'], $formValues['user'], $exception->getMessage()), 1346758663, $exception);
            }
            try {
                $this->connectToDatabase($connectionSettings);
            } catch (DBALException $exception) {
                throw new SetupException(sprintf('Could not connect to database "%s". Please check the permissions for user "%s". DBAL Exception: "%s"', $formValues['dbname'], $formValues['user'], $exception->getMessage()), 1351000864);
            } catch (\PDOException $exception) {
                throw new SetupException(sprintf('Could not connect to database "%s". Please check the permissions for user "%s". PDO Exception: "%s"', $formValues['dbname'], $formValues['user'], $exception->getMessage()), 1346758737);
            }
        }

        $migrationExecuted = Scripts::executeCommand('neos.flow:doctrine:migrate', $settings, false);
        if ($migrationExecuted !== true) {
            throw new SetupException(sprintf('Could not execute database migrations. Please check the permissions for user "%s" and execute "./flow neos.flow:doctrine:migrate" manually.', $formValues['user']), 1346759486);
        }

        $this->resetPolicyRolesCacheAfterDatabaseChanges();
    }
147464
protected function getInputValueDefinitions(Collection $argumentValues): array
    {
        return $argumentValues
            ->mapWithKeys(function (ArgumentValue $argumentValue): array {
                return [
                    $argumentValue->getName() => $this->argumentFactory->handle($argumentValue),
                ];
            })
            ->all();
    }
24982
public function getQueryPartForAdditionalFields(array $fieldValues)
    {
        $queryForSet = '';
        $queryForExecute = '';

        $queryBuilder = Db::getQueryBuilder('tx_kesearch_index');

        foreach ($this->additionalFields as $value) {
            $queryForSet .= ', @' . $value . ' = ' . $queryBuilder->quote($fieldValues[$value], \PDO::PARAM_STR);
            $queryForExecute .= ', @' . $value;
        }
        return array('set' => $queryForSet, 'execute' => $queryForExecute);
    }
424678
public function andReturnValues(array $returnValues)
    {
        $this->andReturn(function() use (&$returnValues) {
            if (count($returnValues) > 1) {
                return array_shift($returnValues);
            } else {
                return current($returnValues);
            }
        });
        
        return $this;
    }
447241
protected function mapArray(array $arrayValues = null)
    {
        if ($arrayValues === null) {
            return [];
        }

        $array = [];
        foreach ($arrayValues as $arrayValue) {
            if ($arrayValue['value'] === null) {
                $array[$arrayValue['index']] = null;
            } else {
                switch ($arrayValue['type']) {
                    case 'integer':
                        $array[$arrayValue['index']] = (int) $arrayValue['value'];
                    break;
                    case 'float':
                        $array[$arrayValue['index']] = (float) $arrayValue['value'];
                    break;
                    case 'boolean':
                        $array[$arrayValue['index']] = (boolean) $arrayValue['value'];
                    break;
                    case 'string':
                        $array[$arrayValue['index']] = (string) $arrayValue['value'];
                    break;
                    case 'DateTime':
                        $array[$arrayValue['index']] = $this->mapDateTime($arrayValue['value']);
                    break;
                    case 'array':
                        $array[$arrayValue['index']] = $this->mapArray($arrayValue['value']);
                    break;
                    case 'SplObjectStorage':
                        $array[$arrayValue['index']] = $this->mapSplObjectStorage($arrayValue['value']);
                    break;
                    default:
                        $array[$arrayValue['index']] = $this->mapToObject($arrayValue['value']);
                    break;
                }
            }
        }

        return $array;
    }