Example #1
0
	/**
	 * @return array
	 */
	public function AjaxCalendarCreate()
	{
		$mResult = false;
		$oAccount = $this->getDefaultAccountFromParam();
		if (!$this->oApiCapability->IsCalendarSupported($oAccount))
		{
			throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\Notifications::CalendarsNotAllowed);
		}
		
		$sName = $this->getParamValue('Name');
		$sDescription = $this->getParamValue('Description'); 
		$sColor = $this->getParamValue('Color'); 
		
		$mCalendarId = $this->oApiCalendar->CreateCalendar($oAccount, $sName, $sDescription, 0, $sColor);
		if ($mCalendarId)
		{
			$oCalendar = $this->oApiCalendar->GetCalendar($oAccount, $mCalendarId);
			if ($oCalendar)
			{
				$mResult = $this->oApiCalendar->GetCalendarAsArray($oAccount, $oCalendar);
			}
		}
		
		return $this->DefaultResponse($oAccount, __FUNCTION__, $mResult);
	}
Example #2
0
 /**
  * @param CAccount $oAccount
  * @param string $sUri
  *
  * @return CalendarInfo|null
  */
 private function &getCalendar($oAccount, $sUri)
 {
     $mResult = null;
     if ($this->oApiCalendarManager) {
         if (!isset($this->aCalendars[$sUri])) {
             $this->aCalendars[$sUri] = $this->oApiCalendarManager->GetCalendar($oAccount, $sUri);
         }
         if (isset($this->aCalendars[$sUri])) {
             $mResult =& $this->aCalendars[$sUri];
         }
     }
     return $mResult;
 }