Esempio n. 1
0
 /** loads the selected and given values to the form
  * this methods loads the selected and given values to the form from the material item or the form_post data
  */
 function _prepareValues()
 {
     $current_context = $this->_environment->getCurrentContextItem();
     if (isset($this->_form_post)) {
         $this->_values = $this->_form_post;
         $tmp_array = array();
         if (isset($this->_form_post['dayStart'])) {
             $tmp_array['dayStart'] = $this->_form_post['dayStart'];
         } else {
             $tmp_array['dayStart'] = '';
         }
         if (isset($this->_form_post['timeStart'])) {
             $tmp_array['timeStart'] = $this->_form_post['timeStart'];
         } else {
             $tmp_array['timeStart'] = '';
         }
         $this->_values['start_date_time'] = $tmp_array;
         if ($current_context->withWorkflow()) {
             $this->_values['workflow_traffic_light'] = $this->_form_post['workflow_traffic_light'];
             $this->_values['workflow_resubmission_date'] = array('workflow_resubmission_date' => $this->_form_post['workflow_resubmission_date']);
             $this->_values['workflow_resubmission_who'] = $this->_form_post['workflow_resubmission_who'];
             $this->_values['workflow_resubmission_who_additional'] = $this->_form_post['workflow_resubmission_who_additional'];
             $this->_values['workflow_resubmission_traffic_light'] = $this->_form_post['workflow_resubmission_traffic_light'];
             $this->_values['workflow_validity_date'] = array('workflow_validity_date' => $this->_form_post['workflow_validity_date']);
             $this->_values['workflow_validity_who'] = $this->_form_post['workflow_validity_who'];
             $this->_values['workflow_validity_who_additional'] = $this->_form_post['workflow_validity_who_additional'];
             $this->_values['workflow_validity_traffic_light'] = $this->_form_post['workflow_validity_traffic_light'];
         }
     } elseif (isset($this->_item)) {
         $this->_values['modification_date'] = $this->_item->getModificationDate();
         $this->_values['iid'] = $this->_item->getItemID();
         $this->_values['vid'] = $this->_item->getVersionID();
         $this->_values['publishing_date'] = $this->_item->getPublishingDate();
         $this->_values['title'] = $this->_item->getTitle();
         $this->_values['description'] = $this->_item->getDescription();
         $this->_values['external_viewer'] = $this->_item->issetExternalViewerStatus();
         $this->_values['external_viewer_accounts'] = $this->_item->getExternalViewerString();
         // file
         $file_array = array();
         $file_list = $this->_item->getFileList();
         if ($file_list->getCount() > 0) {
             $file_item = $file_list->getFirst();
             while ($file_item) {
                 $file_array[] = $file_item->getFileID();
                 $file_item = $file_list->getNext();
             }
         }
         if (isset($this->_form_post['filelist'])) {
             $this->_values['filelist'] = $this->_form_post['filelist'];
         } else {
             $this->_values['filelist'] = $file_array;
         }
         if ($current_context->withActivatingContent()) {
             if ($this->_item->isPrivateEditing()) {
                 $this->_values['private_editing'] = 1;
             } else {
                 $this->_values['private_editing'] = $this->_item->isPrivateEditing();
             }
         } else {
             $this->_values['public'] = $this->_item->isPublic();
         }
         if ($current_context->withWorkflow()) {
             $this->_values['workflow_traffic_light'] = $this->_item->getWorkflowTrafficLight();
             $this->_values['workflow_resubmission'] = $this->_item->getWorkflowResubmission();
             if ($this->_item->getWorkflowResubmissionDate() != '' and $this->_item->getWorkflowResubmissionDate() != '0000-00-00 00:00:00') {
                 $this->_values['workflow_resubmission_date']['workflow_resubmission_date'] = getDateInLang($this->_item->getWorkflowResubmissionDate());
             } else {
                 $this->_values['workflow_resubmission_date']['workflow_resubmission_date'] = '';
             }
             $this->_values['workflow_resubmission_who'] = $this->_item->getWorkflowResubmissionWho();
             $this->_values['workflow_resubmission_who_additional'] = $this->_item->getWorkflowResubmissionWhoAdditional();
             $this->_values['workflow_resubmission_traffic_light'] = $this->_item->getWorkflowResubmissionTrafficLight();
             $this->_values['workflow_validity'] = $this->_item->getWorkflowValidity();
             if ($this->_item->getWorkflowValidityDate() != '' and $this->_item->getWorkflowValidityDate() != '0000-00-00 00:00:00') {
                 $this->_values['workflow_validity_date']['workflow_validity_date'] = getDateInLang($this->_item->getWorkflowValidityDate());
             } else {
                 $this->_values['workflow_validity_date']['workflow_validity_date'] = '';
             }
             $this->_values['workflow_validity_who'] = $this->_item->getWorkflowValidityWho();
             $this->_values['workflow_validity_who_additional'] = $this->_item->getWorkflowValidityWhoAdditional();
             $this->_values['workflow_validity_traffic_light'] = $this->_item->getWorkflowValidityTrafficLight();
         }
         // rubric connections
         $this->_setValuesForRubricConnections();
         $this->_values['author'] = $this->_item->getAuthor();
         // no encode here - encode in form-views
         $this->_values['bib_kind'] = $this->_item->getBibKind();
         $this->_values['publisher'] = $this->_item->getPublisher();
         $this->_values['address'] = $this->_item->getAddress();
         $this->_values['edition'] = $this->_item->getEdition();
         $this->_values['series'] = $this->_item->getSeries();
         $this->_values['volume'] = $this->_item->getVolume();
         $this->_values['isbn'] = $this->_item->getISBN();
         $this->_values['issn'] = $this->_item->getISSN();
         $this->_values['editor'] = $this->_item->getEditor();
         $this->_values['booktitle'] = $this->_item->getBooktitle();
         $this->_values['pages'] = $this->_item->getPages();
         $this->_values['journal'] = $this->_item->getJournal();
         $this->_values['issue'] = $this->_item->getIssue();
         $this->_values['thesis_kind'] = $this->_item->getThesisKind();
         $this->_values['university'] = $this->_item->getUniversity();
         $this->_values['faculty'] = $this->_item->getFaculty();
         $this->_values['common'] = $this->_item->getBibliographicValues();
         $this->_values['url'] = $this->_item->getURL();
         $this->_values['url_date'] = $this->_item->getURLDate();
         /** Start Dokumentenverwaltung **/
         $this->_values['document_editor'] = $this->_item->getDocumentEditor();
         $this->_values['document_maintainer'] = $this->_item->getDocumentMaintainer();
         $this->_values['document_release_number'] = $this->_item->getDocumentReleaseNumber();
         $this->_values['document_release_date'] = $this->_item->getDocumentReleaseDate();
         /** Ende Dokumentenverwaltung **/
         if (empty($this->_values['bib_kind']) and !empty($this->_values['common'])) {
             $this->_values['bib_kind'] = 'common';
         }
         $this->_values['hide'] = $this->_item->isNotActivated() ? '1' : '0';
         if ($this->_item->isNotActivated()) {
             $activating_date = $this->_item->getActivatingDate();
             if (!strstr($activating_date, '9999-00-00')) {
                 $array = array();
                 $array['dayStart'] = getDateInLang($activating_date);
                 $array['timeStart'] = getTimeInLang($activating_date);
                 $this->_values['start_date_time'] = $array;
             }
         }
     } else {
         if ($current_context->withActivatingContent()) {
             if (!isset($this->_values['private_editing'])) {
                 $this->_values['private_editing'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '0' : '1';
                 //In projectrooms everybody can edit the item by default, else default is creator only
             }
         } else {
             if (!isset($this->_values['public'])) {
                 $this->_values['public'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '1' : '0';
                 //In projectrooms everybody can edit the item by default, else default is creator only
             }
         }
         if ($current_context->withWorkflow()) {
             $this->_values['workflow_traffic_light'] = $current_context->getWorkflowTrafficLightDefault();
             $this->_values['workflow_resubmission'] = false;
             $this->_values['workflow_resubmission_date']['workflow_resubmission_date'] = '';
             $this->_values['workflow_resubmission_who'] = 'creator';
             $this->_values['workflow_resubmission_traffic_light'] = '3_none';
             $this->_values['workflow_validity'] = false;
             $this->_values['workflow_validity_date']['workflow_validity_date'] = '';
             $this->_values['workflow_validity_who'] = 'creator';
             $this->_values['workflow_validity_traffic_light'] = '3_none';
         }
     }
 }
Esempio n. 2
0
 /** loads the selected and given values to the form
  * this methods loads the selected and given values to the form from the material item or the form_post data
  */
 function _prepareValues()
 {
     $current_context = $this->_environment->getCurrentContextItem();
     $this->_values = array();
     if (!empty($this->_form_post)) {
         $this->_form_post['end_date_time'] = array();
         $this->_form_post['end_date_time'][] = !empty($this->_form_post['dayEnd']) ? $this->_form_post['dayEnd'] : NULL;
         $this->_form_post['end_date_time'][] = !empty($this->_form_post['timeEnd']) ? $this->_form_post['timeEnd'] : NULL;
         unset($this->_form_post['dayEnd']);
         unset($this->_form_post['timeEnd']);
         $this->_values = $this->_form_post;
         $tmp_array = array();
         if (isset($this->_form_post['dayStart'])) {
             $tmp_array['dayStart'] = $this->_form_post['dayStart'];
         } else {
             $tmp_array['dayStart'] = '';
         }
         if (isset($this->_form_post['timeStart'])) {
             $tmp_array['timeStart'] = $this->_form_post['timeStart'];
         } else {
             $tmp_array['timeStart'] = '';
         }
         $this->_values['start_date_time'] = $tmp_array;
     } elseif (isset($this->_item)) {
         $this->_values['iid'] = $this->_item->getItemID();
         $this->_values['title'] = $this->_item->getTitle();
         $this->_values['description'] = $this->_item->getDescription();
         $this->_values['public'] = $this->_item->isPublic();
         if (!$this->_item->getSeconddateTime() == '') {
             $this->_values['end_date_time'][] = getDateInLang($this->_item->getSeconddateTime());
         } else {
             $this->_values['end_date_time'][] = '';
         }
         if (!$this->_item->getSeconddateTime() == '') {
             $this->_values['end_date_time'][] = getTimeInLang($this->_item->getSeconddateTime());
         } else {
             $this->_values['end_date_time'][] = '';
         }
         $this->_setValuesForRubricConnections();
         // file
         $file_array = array();
         $file_list = $this->_item->getFileList();
         if ($file_list->getCount() > 0) {
             $file_item = $file_list->getFirst();
             while ($file_item) {
                 $file_array[] = $file_item->getFileID();
                 $file_item = $file_list->getNext();
             }
         }
         if (isset($this->_form_post['filelist'])) {
             $this->_values['filelist'] = $this->_form_post['filelist'];
         } else {
             $this->_values['filelist'] = $file_array;
         }
         if ($current_context->withActivatingContent()) {
             if ($this->_item->isPrivateEditing()) {
                 $this->_values['private_editing'] = 1;
             } else {
                 $this->_values['private_editing'] = $this->_item->isPrivateEditing();
             }
         } else {
             $this->_values['public'] = $this->_item->isPublic();
         }
         $this->_values['hide'] = $this->_item->isNotActivated() ? '1' : '0';
         if ($this->_item->isNotActivated()) {
             $activating_date = $this->_item->getActivatingDate();
             if (!strstr($activating_date, '9999-00-00')) {
                 $array = array();
                 $array['dayStart'] = getDateInLang($activating_date);
                 $array['timeStart'] = getTimeInLang($activating_date);
                 $this->_values['start_date_time'] = $array;
             }
         }
     } else {
         if ($this->_environment->inProjectRoom()) {
             $context_item = $this->_environment->getCurrentContextItem();
             $time = $context_item->getTimeSpread();
             $this->_values['end_date_time'][] = getDateInLang(DateAdd($time, date("Y-m-d"), "Y-m-d"));
             $this->_values['end_date_time'][] = date("H:m");
         }
         if ($current_context->withActivatingContent()) {
             if (!isset($this->_values['private_editing'])) {
                 $this->_values['private_editing'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '0' : '1';
                 //In projectrooms everybody can edit the item by default, else default is creator only
             }
         } else {
             if (!isset($this->_values['public'])) {
                 $this->_values['public'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '1' : '0';
                 //In projectrooms everybody can edit the item by default, else default is creator only
             }
         }
     }
 }
Esempio n. 3
0
 							$email_addresses[$environment->getSelectedLanguage()][] = $moderator_item->getEmail();
 						} elseif ($language == 'user' and $moderator_item->getLanguage() != 'browser') {
 							$email_addresses[$moderator_item->getLanguage()][] = $moderator_item->getEmail();
 						} else {
 							$email_addresses[$room_item->getLanguage()][] = $moderator_item->getEmail();
 						}
 						$recipients .= $moderator_item->getFullname().LF;
 					}
 					$moderator_item = $user_list->getNext();
 				}
 				foreach ($email_addresses as $language => $email_array) {
 					if (count($email_array) > 0) {
 						$old_lang = $translator->getSelectedLanguage();
 						$translator->setSelectedLanguage($language);
 						$subject = $translator->getMessage('USER_JOIN_CONTEXT_MAIL_SUBJECT',$user_item->getFullname(),$room_item->getTitle());
 						$body  = $translator->getMessage('MAIL_AUTO',$translator->getDateInLang(getCurrentDateTimeInMySQL()),getTimeInLang(getCurrentDateTimeInMySQL()));
 						$body .= LF.LF;
 						if ( $room_item->isCommunityRoom() ) {
 							$portal = $environment->getCurrentContextItem();
 							if($portal->getHideAccountname()){
 								// Hide useraccountname
 								$user_id = $translator->getMessage('USER_ACCOUNT_NOT_VISIBLE');
 								$body .= $translator->getMessage('USER_JOIN_COMMUNITY_MAIL_BODY_BY_MODERATOR',$user_item->getFullname(),$user_id,$user_item->getEmail(),$room_item->getTitle(),$current_user->getFullname());
 							} else {
 								$body .= $translator->getMessage('USER_JOIN_COMMUNITY_MAIL_BODY_BY_MODERATOR',$user_item->getFullname(),$user_item->getUserID(),$user_item->getEmail(),$room_item->getTitle(),$current_user->getFullname());
 							}
 						} else {
 							$portal = $environment->getCurrentContextItem();
 							if($portal->getHideAccountname()){
 								// Hide useraccountname
 								$user_id = $translator->getMessage('USER_ACCOUNT_NOT_VISIBLE');
Esempio n. 4
0
 /** loads the selected and given values to the form
  * this methods loads the selected and given values to the form from the material item or the form_post data
  */
 function _prepareValues()
 {
     $current_context = $this->_environment->getCurrentContextItem();
     $this->_values = array();
     if (!empty($this->_form_post)) {
         $this->_values = $this->_form_post;
         if (!isset($this->_values['public'])) {
             $this->_values['public'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '1' : '0';
             //In projectrooms everybody can edit the item by default, else default is creator only
         }
         if (!isset($this->_values['discussion_type'])) {
             $this->_values['discussion_type'] = '1';
         }
         $tmp_array = array();
         if (isset($this->_form_post['dayStart'])) {
             $tmp_array['dayStart'] = $this->_form_post['dayStart'];
         } else {
             $tmp_array['dayStart'] = '';
         }
         if (isset($this->_form_post['timeStart'])) {
             $tmp_array['timeStart'] = $this->_form_post['timeStart'];
         } else {
             $tmp_array['timeStart'] = '';
         }
         $this->_values['start_date_time'] = $tmp_array;
     } elseif (isset($this->_item)) {
         $this->_values['iid'] = $this->_item->getItemID();
         $this->_values['title'] = $this->_item->getTitle();
         $this->_values['public'] = $this->_item->isPublic();
         $this->_setValuesForRubricConnections();
         $this->_values['external_viewer'] = $this->_item->issetExternalViewerStatus();
         $this->_values['external_viewer_accounts'] = $this->_item->getExternalViewerString();
         if ($current_context->withActivatingContent()) {
             if ($this->_item->isPrivateEditing()) {
                 $this->_values['private_editing'] = 1;
             } else {
                 $this->_values['private_editing'] = $this->_item->isPrivateEditing();
             }
         } else {
             $this->_values['public'] = $this->_item->isPublic();
         }
         $this->_values['hide'] = $this->_item->isNotActivated() ? '1' : '0';
         if ($this->_item->isNotActivated()) {
             $activating_date = $this->_item->getActivatingDate();
             if (!strstr($activating_date, '9999-00-00')) {
                 $array = array();
                 $array['dayStart'] = getDateInLang($activating_date);
                 $array['timeStart'] = getTimeInLang($activating_date);
                 $this->_values['start_date_time'] = $array;
             }
         }
     } else {
         $this->_values['discussion_type'] = '1';
         $this->_values['subject'] = $this->_translator->getMessage('INITIALARTICLE');
         if ($current_context->withActivatingContent()) {
             if (!isset($this->_values['private_editing'])) {
                 $this->_values['private_editing'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '0' : '1';
                 //In projectrooms everybody can edit the item by default, else default is creator only
             }
         } else {
             if (!isset($this->_values['public'])) {
                 $this->_values['public'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '1' : '0';
                 //In projectrooms everybody can edit the item by default, else default is creator only
             }
         }
     }
 }
Esempio n. 5
0
 /** loads the selected and given values to the form
  * this methods loads the selected and given values to the form from the material item or the form_post data
  *
  * @author CommSy Development Group
  */
 function _prepareValues()
 {
     $this->_values = array();
     if (!empty($this->_form_post)) {
         $temp_array = array();
         if (isset($this->_form_post['dayActivateStart'])) {
             $temp_array['dayActivateStart'] = $this->_form_post['dayActivateStart'];
         } else {
             $temp_array['dayActivateStart'] = '';
         }
         if (isset($this->_form_post['timeActivateStart'])) {
             $temp_array['timeActivateStart'] = $this->_form_post['timeActivateStart'];
         } else {
             $temp_array['timeActivateStart'] = '';
         }
         $this->_form_post['start_activate_date_time'] = $temp_array;
         $temp_array = array();
         if (!empty($this->_form_post['dayStart'])) {
             $temp_array[] = $this->_form_post['dayStart'];
         } else {
             $temp_array[] = '';
         }
         if (!empty($this->_form_post['timeStart'])) {
             $temp_array[] = $this->_form_post['timeStart'];
         } else {
             $temp_array[] = '';
         }
         $this->_form_post['start_date_time'] = $temp_array;
         $temp_time_array = array();
         if (!empty($this->_form_post['dayEnd'])) {
             $temp_time_array['dayEnd'] = $this->_form_post['dayEnd'];
         } else {
             $temp_time_array['dayEnd'] = '';
         }
         if (!empty($this->_form_post['timeEnd'])) {
             $temp_time_array['timeEnd'] = $this->_form_post['timeEnd'];
         } else {
             $temp_time_array['timeEnd'] = '';
         }
         $this->_form_post['end_date_time'] = $temp_time_array;
         $this->_values = $this->_form_post;
         if (!isset($this->_values['public'])) {
             $this->_values['public'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '1' : '0';
             //In projectrooms everybody can edit the item by default, else default is creator only
         }
         #if ( !empty($this->_form_post['colorpicker']) ) {
         #   $this->_values['colorpicker'] = '<br/><br/><INPUT class="color" value="' . $_POST['colorpicker'] . '" name="colorpicker">';
         #   $this->_color = $_POST['colorpicker'];
         #}
         if (isset($this->_form_post['date_addon_color'])) {
             $this->_values['date_addon_color'] = $this->_form_post['date_addon_color'];
         }
         if (isset($this->_form_post['recurring'])) {
             $this->_values['recurring'] = $this->_form_post['recurring'];
             // avoid "manipulation of data"-error
             if ($this->_form_post['recurring_select'] == 'daily') {
                 unset($this->_form_post['recurring_month']);
                 unset($this->_form_post['recurring_month_every']);
                 unset($this->_form_post['recurring_month_day_every']);
                 unset($this->_form_post['recurring_year_every']);
                 unset($this->_form_post['recurring_week']);
                 unset($this->_form_post['recurring_week_days']);
             } elseif ($this->_form_post['recurring_select'] == 'weekly') {
                 unset($this->_form_post['recurring_month']);
                 unset($this->_form_post['recurring_month_every']);
                 unset($this->_form_post['recurring_month_day_every']);
                 unset($this->_form_post['recurring_year_every']);
                 unset($this->_form_post['recurring_day']);
             } elseif ($this->_form_post['recurring_select'] == 'monthly') {
                 unset($this->_form_post['recurring_week']);
                 unset($this->_form_post['recurring_week_days']);
                 unset($this->_form_post['recurring_year_every']);
                 unset($this->_form_post['recurring_day']);
             } elseif ($this->_form_post['recurring_select'] == 'yearly') {
                 unset($this->_form_post['recurring_month']);
                 unset($this->_form_post['recurring_month_every']);
                 unset($this->_form_post['recurring_month_day_every']);
                 unset($this->_form_post['recurring_day']);
                 unset($this->_form_post['recurring_week']);
                 unset($this->_form_post['recurring_week_days']);
             }
         }
     } elseif (isset($this->_item)) {
         $this->_values['external_viewer'] = $this->_item->issetExternalViewerStatus();
         $this->_values['external_viewer_accounts'] = $this->_item->getExternalViewerString();
         $this->_values['iid'] = $this->_item->getItemID();
         $this->_values['title'] = $this->_item->getTitle();
         $this->_values['description'] = $this->_item->getDescription();
         $this->_values['mode'] = $this->_item->getDateMode();
         // DATE AND TIME
         $temp_array = array();
         $temp = convertDateFromInput($this->_item->getStartingDay(), $this->_environment->getSelectedLanguage());
         if ($temp['conforms']) {
             $temp_array['dayStart'] = getDateInLang($this->_item->getStartingDay());
         } else {
             $temp_array['dayStart'] = $this->_item->getStartingDay();
         }
         $temp = convertTimeFromInput($this->_item->getStartingTime());
         if ($temp['conforms'] == TRUE) {
             $temp_array['timeStart'] = getTimeLanguage($this->_item->getStartingTime());
         } else {
             $temp_array['timeStart'] = $this->_item->getStartingTime();
         }
         $this->_values['start_date_time'] = $temp_array;
         $temp_array = array();
         $temp = convertDateFromInput($this->_item->getEndingDay(), $this->_environment->getSelectedLanguage());
         if ($temp['conforms']) {
             $temp_array['dayEnd'] = getDateInLang($this->_item->getEndingDay());
         } else {
             $temp_array['dayEnd'] = $this->_item->getEndingDay();
         }
         $temp = convertTimeFromInput($this->_item->getEndingTime());
         if ($temp['conforms'] == TRUE) {
             $temp_array['timeEnd'] = getTimeLanguage($this->_item->getEndingTime());
         } else {
             $temp_array['timeEnd'] = $this->_item->getEndingTime();
         }
         $this->_values['end_date_time'] = $temp_array;
         $this->_values['place'] = $this->_item->getPlace();
         $current_context = $this->_environment->getCurrentContextItem();
         if ($current_context->withActivatingContent()) {
             if ($this->_item->isPrivateEditing()) {
                 $this->_values['private_editing'] = 1;
             } else {
                 $this->_values['private_editing'] = $this->_item->isPrivateEditing();
             }
         } else {
             $this->_values['public'] = $this->_item->isPublic();
         }
         $this->_setValuesForRubricConnections();
         // file
         $file_array = array();
         $file_list = $this->_item->getFileList();
         if ($file_list->getCount() > 0) {
             $file_item = $file_list->getFirst();
             while ($file_item) {
                 $file_array[] = $file_item->getFileID();
                 $file_item = $file_list->getNext();
             }
         }
         if (isset($this->_form_post['filelist'])) {
             $this->_values['filelist'] = $this->_form_post['filelist'];
         } else {
             $this->_values['filelist'] = $file_array;
         }
         $this->_values['hide'] = $this->_item->isNotActivated() ? '1' : '0';
         if ($this->_item->isNotActivated()) {
             $activating_date = $this->_item->getActivatingDate();
             if (!strstr($activating_date, '9999-00-00')) {
                 $array = array();
                 $array['dayActivateStart'] = getDateInLang($activating_date);
                 $array['timeActivateStart'] = getTimeInLang($activating_date);
                 $this->_values['start_activate_date_time'] = $array;
             }
         }
         if ($this->_item->getColor() != '') {
             //$this->_values['colorpicker'] = '<br/><br/><INPUT class="color" value="' . $this->_item->getColor() . '" name="colorpicker">';
             $this->_values['date_addon_color'] = $this->_item->getColor();
             #$this->_color = $this->_item->getColor();
         }
     } else {
         $temp_array['dayStart'] = $this->_private_date_starting_date;
         $temp_array['timeStart'] = $this->_private_date_starting_time;
         $this->_values['start_date_time'] = $temp_array;
         $temp_array = array();
         $temp_array['dayEnd'] = $this->_private_date_ending_date;
         $temp_array['timeEnd'] = $this->_private_date_ending_time;
         $this->_values['end_date_time'] = $temp_array;
         $current_context = $this->_environment->getCurrentContextItem();
         if ($current_context->withActivatingContent()) {
             if (!isset($this->_values['private_editing'])) {
                 $this->_values['private_editing'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '0' : '1';
                 //In projectrooms everybody can edit the item by default, else default is creator only
             }
         } else {
             if (!isset($this->_values['public'])) {
                 $this->_values['public'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '1' : '0';
                 //In projectrooms everybody can edit the item by default, else default is creator only
             }
         }
         #$this->_values['date_addon_color'] = '#FFFF66';
     }
 }
function write_email_to_moderators($user_item, $room){
   global $environment;
   $translator = $environment->getTranslationObject();

   $room_manager = $environment->getRoomManager();
   $room_item = $room_manager->getItem($room);

   $user_manager = $environment->getUserManager();
   $user_manager->resetLimits();
   $user_manager->setModeratorLimit();
   $user_manager->setContextLimit($room);
   $user_manager->select();
   $user_list = $user_manager->get();
   $email_addresses = array();
   $moderator_item = $user_list->getFirst();
   $recipients = '';
   $language = $room_item->getLanguage();
   while ($moderator_item) {
      $want_mail = $moderator_item->getAccountWantMail();
      if (!empty($want_mail) and $want_mail == 'yes') {
         if ($language == 'user' and $moderator_item->getLanguage() == 'browser') {
            $email_addresses[$environment->getSelectedLanguage()][] = $moderator_item->getEmail();
         } elseif ($language == 'user' and $moderator_item->getLanguage() != 'browser') {
            $email_addresses[$moderator_item->getLanguage()][] = $moderator_item->getEmail();
         } else {
            $email_addresses[$room_item->getLanguage()][] = $moderator_item->getEmail();
         }
         $recipients .= $moderator_item->getFullname().LF;
      }
       $moderator_item = $user_list->getNext();
   }
   if ( !$room_item->checkNewMembersNever() and !$room_item->checkNewMembersWithCode()) {
      $check_message = 'YES'; // for mail body
   } else {
      $check_message = 'NO';
   }
   foreach ($email_addresses as $language => $email_array) {
      if (count($email_array) > 0) {
         $old_lang = $translator->getSelectedLanguage();
         $translator->setSelectedLanguage($language);
         $subject = $translator->getMessage('USER_JOIN_CONTEXT_MAIL_SUBJECT',$user_item->getFullname(),$room_item->getTitle());
         $body  = $translator->getMessage('MAIL_AUTO',$translator->getDateInLang(getCurrentDateTimeInMySQL()),getTimeInLang(getCurrentDateTimeInMySQL()));
         $body .= LF.LF;
         if ( $room_item->isCommunityRoom() ) {
            $body .= $translator->getMessage('USER_JOIN_COMMUNITY_MAIL_BODY',$user_item->getFullname(),$user_item->getUserID(),$user_item->getEmail(),$room_item->getTitle());
         } else {
            $body .= $translator->getMessage('USER_JOIN_CONTEXT_MAIL_BODY',$user_item->getFullname(),$user_item->getUserID(),$user_item->getEmail(),$room_item->getTitle());
         }
         $body .= LF.LF;
         if ($check_message == 'YES') {
            $body .= $translator->getMessage('USER_GET_MAIL_STATUS_YES');
         } else {
            $body .= $translator->getMessage('USER_GET_MAIL_STATUS_NO');
         }
         $body .= LF.LF;
         $body .= $translator->getMessage('MAIL_SEND_TO',$recipients);
         $body .= LF;
         if ($check_message == 'YES') {
            $body .= $translator->getMessage('MAIL_USER_FREE_LINK').LF;
            $body .= 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?cid='.$room.'&mod=account&fct=index'.'&selstatus=1';
         } else {
            $body .= 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?cid='.$room;
         }
         include_once('classes/cs_mail.php');
         $mail = new cs_mail();
         $mail->set_to(implode(',',$email_array));
         $server_item = $environment->getServerItem();
         $default_sender_address = $server_item->getDefaultSenderAddress();
         if (!empty($default_sender_address)) {
            $mail->set_from_email($default_sender_address);
         } else {
            $mail->set_from_email('@');
         }
         $current_context = $environment->getCurrentContextItem();
         $mail->set_from_name($translator->getMessage('SYSTEM_MAIL_MESSAGE',$current_context->getTitle()));
         $mail->set_from_name($room_item->getTitle());
         $mail->set_reply_to_name($user_item->getFullname());
         $mail->set_reply_to_email($user_item->getEmail());
         $mail->set_subject($subject);
         $mail->set_message($body);
         $mail->send();
         $translator->setSelectedLanguage($old_lang);
      }
   }
}
 public function initPopup($item, $data)
 {
     if (!empty($data['editType'])) {
         $this->_edit_type = $data['editType'];
         $this->_popup_controller->assign('item', 'edit_type', $data['editType']);
     }
     // assign template vars
     $this->assignTemplateVars();
     $current_context = $this->_environment->getCurrentContextItem();
     if ($item !== null) {
         // edit mode
         // TODO: check rights
         // files
         $attachment_infos = array();
         $converter = $this->_environment->getTextConverter();
         $file_list = $item->getFileList();
         $file = $file_list->getFirst();
         while ($file) {
             #$info['file_name']	= $converter->text_as_html_short($file->getDisplayName());
             $info['file_name'] = $converter->filenameFormatting($file->getDisplayName());
             $info['file_icon'] = $file->getFileIcon();
             $info['file_id'] = $file->getFileID();
             $attachment_infos[] = $info;
             $file = $file_list->getNext();
         }
         $this->_popup_controller->assign('item', 'files', $attachment_infos);
         $this->_popup_controller->assign('item', 'title', $item->getTitle());
         // old formating
         $c_old_text_formating_array = $this->_environment->getConfiguration('c_old_text_formating_array');
         if (!empty($c_old_text_formating_array) and is_array($c_old_text_formating_array) and in_array($this->_environment->getCurrentContextID(), $c_old_text_formating_array)) {
             $this->_with_old_text_formating = true;
         }
         if ($this->_with_old_text_formating) {
             $desc_string = $item->getDescription();
             $desc_string = preg_replace('/(?:[ \\t]*(?:\\n|\\r\\n?)){2,}/', "\n", $desc_string);
             $desc_string = nl2br($desc_string);
             $desc_string = str_replace('<br /><br />', '<br />', $desc_string);
             $this->_popup_controller->assign('item', 'description', $desc_string);
         } else {
             $this->_popup_controller->assign('item', 'description', $item->getDescription());
         }
         $this->_popup_controller->assign('item', 'public', $item->isPublic());
         if ($item->getSeconddateTime() != '') {
             $this->_popup_controller->assign('item', 'dayEnd', mb_substr($item->getSeconddateTime(), 0, 10));
             $this->_popup_controller->assign('item', 'timeEnd', getTimeInLang($item->getSeconddateTime()));
         } else {
             $time = $current_context->getTimeSpread();
             $this->_popup_controller->assign('item', 'dayEnd', DateAdd($time, date("Y-m-d"), "Y-m-d"));
             $this->_popup_controller->assign('item', 'timeEnd', date("H:m"));
         }
         $activating = false;
         if ($current_context->withActivatingContent()) {
             $activating = true;
             $this->_popup_controller->assign('item', 'private_editing', $item->isPrivateEditing());
             if ($item->isNotActivated()) {
                 $this->_popup_controller->assign('item', 'is_not_activated', true);
                 $activating_date = $item->getActivatingDate();
                 if (!stristr($activating_date, '9999')) {
                     $this->_popup_controller->assign('item', 'activating_date', mb_substr($activating_date, 0, 10));
                     $this->_popup_controller->assign('item', 'activating_time', mb_substr($activating_date, -8));
                 }
             }
         }
         $this->_popup_controller->assign('popup', 'activating', $activating);
     } else {
         $time = $current_context->getTimeSpread();
         $this->_popup_controller->assign('item', 'dayEnd', DateAdd($time, date("Y-m-d"), "Y-m-d"));
         $this->_popup_controller->assign('item', 'timeEnd', date("H:m"));
         if ($current_context->isCommunityRoom()) {
             $this->_popup_controller->assign('item', 'public', '1');
         } else {
             $this->_popup_controller->assign('item', 'public', '0');
         }
     }
 }
Esempio n. 8
0
 public function initPopup($item, $data)
 {
     if (!empty($data['editType'])) {
         $this->_edit_type = $data['editType'];
         $this->_popup_controller->assign('item', 'edit_type', $data['editType']);
     }
     // assign template vars
     $this->assignTemplateVars();
     $current_context = $this->_environment->getCurrentContextItem();
     $translator = $this->_environment->getTranslationObject();
     if ($item !== null) {
         // edit mode
         // TODO: check rights
         // files
         $attachment_infos = array();
         $converter = $this->_environment->getTextConverter();
         $file_list = $item->getFileList();
         $file = $file_list->getFirst();
         while ($file) {
             #$info['file_name']	= $converter->text_as_html_short($file->getDisplayName());
             $info['file_name'] = $converter->filenameFormatting($file->getDisplayName());
             $info['file_icon'] = $file->getFileIcon();
             $info['file_id'] = $file->getFileID();
             $attachment_infos[] = $info;
             $file = $file_list->getNext();
         }
         $this->_popup_controller->assign('item', 'files', $attachment_infos);
         $this->_popup_controller->assign('item', 'title', $item->getTitle());
         // old formating
         $c_old_text_formating_array = $this->_environment->getConfiguration('c_old_text_formating_array');
         if (!empty($c_old_text_formating_array) and is_array($c_old_text_formating_array) and in_array($this->_environment->getCurrentContextID(), $c_old_text_formating_array)) {
             $this->_with_old_text_formating = true;
         }
         if ($this->_with_old_text_formating) {
             $desc_string = $item->getDescription();
             $desc_string = preg_replace('/(?:[ \\t]*(?:\\n|\\r\\n?)){2,}/', "\n", $desc_string);
             $desc_string = nl2br($desc_string);
             $desc_string = str_replace('<br /><br />', '<br />', $desc_string);
             $this->_popup_controller->assign('item', 'description', $desc_string);
         } else {
             $this->_popup_controller->assign('item', 'description', $item->getDescription());
         }
         $this->_popup_controller->assign('item', 'public', $item->isPublic());
         $this->_popup_controller->assign('item', 'status', $item->getInternalStatus());
         $this->_popup_controller->assign('item', 'time_type', $item->getTimeType());
         if ($data["contextId"]) {
             $this->_popup_controller->assign('item', 'external_viewer', $item->issetExternalViewerStatus());
             $this->_popup_controller->assign('item', 'external_viewer_accounts', $item->getExternalViewerString());
         }
         $status_array = array();
         $temp_array['text'] = $translator->getMessage('TODO_NOT_STARTED');
         $temp_array['value'] = '1';
         $status_array[] = $temp_array;
         $temp_array['text'] = $translator->getMessage('TODO_IN_POGRESS');
         $temp_array['value'] = '2';
         $status_array[] = $temp_array;
         $temp_array['text'] = $translator->getMessage('TODO_DONE');
         $temp_array['value'] = '3';
         $status_array[] = $temp_array;
         $extra_status_array = $current_context->getExtraToDoStatusArray();
         foreach ($extra_status_array as $key => $value) {
             $temp_array['text'] = $value;
             $temp_array['value'] = $key;
             $status_array[] = $temp_array;
         }
         $this->_popup_controller->assign('item', 'status_array', $status_array);
         $time = $item->getPlannedTime();
         $minutes = $item->getPlannedTime();
         switch ($item->getTimeType()) {
             case 2:
                 $minutes = $minutes / 60;
                 break;
             case 3:
                 $minutes = $minutes / 60 / 8;
                 break;
         }
         if ($translator->getSelectedLanguage() == 'de') {
             $minutes = str_replace('.', ',', $minutes);
         }
         $this->_popup_controller->assign('item', 'minutes', $minutes);
         if ($item->getDate() != '' and $item->getDate() != '9999-00-00 00:00:00') {
             $this->_popup_controller->assign('item', 'day_end', mb_substr($item->getDate(), 0, 10));
         } else {
             $this->_popup_controller->assign('item', 'day_end', '');
         }
         if ($item->getDate() != '' and $item->getDate() != '9999-00-00 00:00:00') {
             $this->_popup_controller->assign('item', 'time_end', getTimeInLang($item->getDate()));
         } else {
             $this->_popup_controller->assign('item', 'time_end', '');
         }
         $activating = false;
         if ($current_context->withActivatingContent()) {
             $activating = true;
             $this->_popup_controller->assign('item', 'private_editing', $item->isPrivateEditing());
             if ($item->isNotActivated()) {
                 $this->_popup_controller->assign('item', 'is_not_activated', true);
                 $activating_date = $item->getActivatingDate();
                 if (!stristr($activating_date, '9999')) {
                     $this->_popup_controller->assign('item', 'activating_date', mb_substr($activating_date, 0, 10));
                     $this->_popup_controller->assign('item', 'activating_time', mb_substr($activating_date, -8));
                 }
             }
         }
         $this->_popup_controller->assign('popup', 'activating', $activating);
     } else {
         $status_array = array();
         $temp_array['text'] = $translator->getMessage('TODO_NOT_STARTED');
         $temp_array['value'] = '1';
         $status_array[] = $temp_array;
         $temp_array['text'] = $translator->getMessage('TODO_IN_POGRESS');
         $temp_array['value'] = '2';
         $status_array[] = $temp_array;
         $temp_array['text'] = $translator->getMessage('TODO_DONE');
         $temp_array['value'] = '3';
         $status_array[] = $temp_array;
         $extra_status_array = $current_context->getExtraToDoStatusArray();
         foreach ($extra_status_array as $key => $value) {
             $temp_array['text'] = $value;
             $temp_array['value'] = $key;
             $status_array[] = $temp_array;
         }
         $this->_popup_controller->assign('item', 'status_array', $status_array);
         $val = $this->_environment->inProjectRoom() || $this->_environment->inGroupRoom() ? '1' : '0';
         $this->_popup_controller->assign('item', 'public', $val);
         $val = $this->_environment->inProjectRoom() || $this->_environment->inGroupRoom() ? false : true;
         $this->_popup_controller->assign('item', 'private_editing', $val);
     }
 }
Esempio n. 9
0
 public function getInformationBoxContent()
 {
     $current_context = $this->_environment->getCurrentContextItem();
     $return_array = array();
     $return_array['show'] = $current_context->withInformationBox();
     $return_array['title'] = '';
     $return_array['iid'] = '';
     $return_array['content'] = '';
     if ($return_array['show']) {
         $id = $current_context->getInformationBoxEntryID();
         $manager = $this->_environment->getItemManager();
         $item = $manager->getItem($id);
         $entry_manager = $this->_environment->getManager($item->getItemType());
         $entry = $entry_manager->getItem($id);
         $return_array['title'] = $entry->getTitle();
         $converter = $this->_environment->getTextConverter();
         $desc = '';
         if (method_exists($entry, 'getDescription')) {
             $desc = $entry->getDescription();
         }
         if (empty($desc)) {
             if ($item->getItemType() == 'discussion') {
                 $discussion_article_manager = $this->_environment->getDiscussionArticleManager();
                 $all_disc_entrys = $discussion_article_manager->getAllArticlesForItem($entry);
                 $item = $all_disc_entrys->getFirst();
                 //             		while($item){
                 //             			// bla
                 //             			$desc .= $item->getDescription();
                 //             			$item = $all_disc_entrys->getNext();
                 //             		}
                 $desc = $item->getDescription();
                 unset($all_disc_entrys);
             }
         }
         if (!empty($desc)) {
             $converter->setFileArray($this->getItemFileList());
             if ($this->_with_old_text_formating) {
                 //$desc = $converter->text_as_html_long($desc);
                 $desc = $converter->textFullHTMLFormatting($desc);
             } else {
                 #$desc = $converter->_text_as_html_long2($desc);
                 #$desc = $converter->cleanDataFromTextArea($desc);
                 $desc = $converter->textFullHTMLFormatting($desc);
             }
         }
         if ($entry->getItemType() == 'date') {
             //$return_array['date'] = $entry->getStartingDay();
             $return_array['date'] = getDateInLang($entry->getDateTime_start());
             $time = getTimeInLang($entry->getDateTime_start());
             if ($time != '00:00') {
                 $return_array['time'] = $time;
             }
         }
         $return_array['content'] = $desc;
         $return_array['rubric'] = $entry->getItemType();
         $return_array['iid'] = $id;
     }
     return $return_array;
 }
Esempio n. 10
0
 /** loads the selected and given values to the form
  * this methods loads the selected and given values to the form from the material item or the form_post data
  *
  * @author CommSy Development Group
  */
 function _prepareValues()
 {
     $current_context = $this->_environment->getCurrentContextItem();
     $this->_values = array();
     if (!empty($this->_form_post)) {
         $this->_form_post['end_date_time'] = array();
         $this->_form_post['end_date_time'][] = !empty($this->_form_post['dayEnd']) ? $this->_form_post['dayEnd'] : NULL;
         $this->_form_post['end_date_time'][] = !empty($this->_form_post['timeEnd']) ? $this->_form_post['timeEnd'] : NULL;
         unset($this->_form_post['dayEnd']);
         unset($this->_form_post['timeEnd']);
         $this->_values = $this->_form_post;
         $tmp_array = array();
         if (isset($this->_form_post['dayStart'])) {
             $tmp_array['dayStart'] = $this->_form_post['dayStart'];
         } else {
             $tmp_array['dayStart'] = '';
         }
         if (isset($this->_form_post['timeStart'])) {
             $tmp_array['timeStart'] = $this->_form_post['timeStart'];
         } else {
             $tmp_array['timeStart'] = '';
         }
         $this->_values['start_date_time'] = $tmp_array;
     } elseif (isset($this->_item)) {
         $this->_values['external_viewer'] = $this->_item->issetExternalViewerStatus();
         $this->_values['external_viewer_accounts'] = $this->_item->getExternalViewerString();
         $this->_values['iid'] = $this->_item->getItemID();
         $this->_values['title'] = $this->_item->getTitle();
         $this->_values['description'] = $this->_item->getDescription();
         $this->_values['public'] = $this->_item->isPublic();
         $this->_values['status'] = $this->_item->getInternalStatus();
         $this->_values['time_type'] = $this->_item->getTimeType();
         $time = $this->_item->getPlannedTime();
         $minutes = $this->_item->getPlannedTime();
         switch ($this->_item->getTimeType()) {
             case 2:
                 $minutes = $minutes / 60;
                 break;
             case 3:
                 $minutes = $minutes / 60 / 8;
                 break;
         }
         if ($this->_translator->getSelectedLanguage() == 'de') {
             $minutes = str_replace('.', ',', $minutes);
         }
         $this->_values['minutes'] = $minutes;
         if ($this->_item->getDate() != '' and $this->_item->getDate() != '9999-00-00 00:00:00') {
             $this->_values['end_date_time'][] = getDateInLang($this->_item->getDate());
         } else {
             $this->_values['end_date_time'][] = '';
         }
         if ($this->_item->getDate() != '' and $this->_item->getDate() != '9999-00-00 00:00:00') {
             $this->_values['end_date_time'][] = getTimeInLang($this->_item->getDate());
         } else {
             $this->_values['end_date_time'][] = '';
         }
         $this->_setValuesForRubricConnections();
         // file
         $file_array = array();
         $file_list = $this->_item->getFileList();
         if ($file_list->getCount() > 0) {
             $file_item = $file_list->getFirst();
             while ($file_item) {
                 $file_array[] = $file_item->getFileID();
                 $file_item = $file_list->getNext();
             }
         }
         if (isset($this->_form_post['filelist'])) {
             $this->_values['filelist'] = $this->_form_post['filelist'];
         } else {
             $this->_values['filelist'] = $file_array;
         }
         if ($current_context->withActivatingContent()) {
             if ($this->_item->isPrivateEditing()) {
                 $this->_values['private_editing'] = 1;
             } else {
                 $this->_values['private_editing'] = $this->_item->isPrivateEditing();
             }
         } else {
             $this->_values['public'] = $this->_item->isPublic();
         }
         $this->_values['hide'] = $this->_item->isNotActivated() ? '1' : '0';
         if ($this->_item->isNotActivated()) {
             $activating_date = $this->_item->getActivatingDate();
             if (!strstr($activating_date, '9999-00-00')) {
                 $array = array();
                 $array['dayStart'] = getDateInLang($activating_date);
                 $array['timeStart'] = getTimeInLang($activating_date);
                 $this->_values['start_date_time'] = $array;
             }
         }
     } else {
         $this->_values['status'] = '1';
         if ($current_context->withActivatingContent()) {
             if (!isset($this->_values['private_editing'])) {
                 $this->_values['private_editing'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '0' : '1';
                 //In projectrooms everybody can edit the item by default, else default is creator only
             }
         } else {
             if (!isset($this->_values['public'])) {
                 $this->_values['public'] = ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom()) ? '1' : '0';
                 //In projectrooms everybody can edit the item by default, else default is creator only
             }
         }
     }
 }