[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 class Documents_Module_Model extends Vtiger_Module_Model { 12 13 /** 14 * Functions tells if the module supports workflow 15 * @return boolean 16 */ 17 public function isWorkflowSupported() { 18 return true; 19 } 20 21 /** 22 * Function to check whether the module is summary view supported 23 * @return <Boolean> - true/false 24 */ 25 public function isSummaryViewSupported() { 26 return false; 27 } 28 29 /** 30 * Function returns the url which gives Documents that have Internal file upload 31 * @return string 32 */ 33 public function getInternalDocumentsURL() { 34 return 'view=Popup&module=Documents&src_module=Emails&src_field=composeEmail'; 35 } 36 37 /** 38 * Function returns list of folders 39 * @return <Array> folder list 40 */ 41 public static function getAllFolders() { 42 $db = PearDatabase::getInstance(); 43 $result = $db->pquery('SELECT * FROM vtiger_attachmentsfolder ORDER BY sequence', array()); 44 45 $folderList = array(); 46 for($i=0; $i<$db->num_rows($result); $i++) { 47 $row = $db->query_result_rowdata($result, $i); 48 $folderList[] = Documents_Folder_Model::getInstanceByArray($row); 49 } 50 return $folderList; 51 } 52 53 /** 54 * Function to get list view query for popup window 55 * @param <String> $sourceModule Parent module 56 * @param <String> $field parent fieldname 57 * @param <Integer> $record parent id 58 * @param <String> $listQuery 59 * @return <String> Listview Query 60 */ 61 public function getQueryByModuleField($sourceModule, $field, $record, $listQuery) { 62 if($sourceModule === 'Emails' && $field === 'composeEmail') { 63 $condition = ' (( vtiger_notes.filelocationtype LIKE "%I%")) AND vtiger_notes.filename != "" AND vtiger_notes.filestatus = 1'; 64 } else { 65 $condition = " vtiger_notes.notesid NOT IN (SELECT notesid FROM vtiger_senotesrel WHERE crmid = '$record') AND vtiger_notes.filestatus = 1"; 66 } 67 $pos = stripos($listQuery, 'where'); 68 if($pos) { 69 $split = spliti('where', $listQuery); 70 $overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition; 71 } else { 72 $overRideQuery = $listQuery. ' WHERE ' . $condition; 73 } 74 return $overRideQuery; 75 } 76 77 /** 78 * Funtion that returns fields that will be showed in the record selection popup 79 * @return <Array of fields> 80 */ 81 public function getPopupViewFieldsList() { 82 $popupFileds = $this->getSummaryViewFieldsList(); 83 foreach ($popupFileds as $fieldName => $fieldModel) { 84 if ($fieldName === 'folderid' || $fieldName === 'modifiedtime') { 85 unset($popupFileds[$fieldName]); 86 } 87 } 88 $reqPopUpFields = array('File Status' => 'filestatus', 89 'File Size' => 'filesize', 90 'File Location Type' => 'filelocationtype'); 91 foreach ($reqPopUpFields as $fieldLabel => $fieldName) { 92 $fieldModel = Vtiger_Field_Model::getInstance($fieldName,$this); 93 if ($fieldModel->getPermissions('readwrite')) { 94 $popupFileds[$fieldName] = $fieldModel; 95 } 96 } 97 return array_keys($popupFileds); 98 } 99 100 /** 101 * Function to get the url for add folder from list view of the module 102 * @return <string> - url 103 */ 104 public function getAddFolderUrl() { 105 return 'index.php?module='.$this->getName().'&view=AddFolder'; 106 } 107 108 /** 109 * Function to get Alphabet Search Field 110 */ 111 public function getAlphabetSearchField(){ 112 return 'notes_title'; 113 } 114 115 /** 116 * Function that returns related list header fields that will be showed in the Related List View 117 * @return <Array> returns related fields list. 118 */ 119 public function getRelatedListFields() { 120 $relatedListFields = parent::getRelatedListFields(); 121 122 //Adding filestatus, filelocationtype in the related list to be used for file download 123 $relatedListFields['filestatus'] = 'filestatus'; 124 $relatedListFields['filelocationtype'] = 'filelocationtype'; 125 126 return $relatedListFields; 127 } 128 129 public function getSettingLinks() { 130 vimport('~~modules/com_vtiger_workflow/VTWorkflowUtils.php'); 131 132 133 $layoutEditorImagePath = Vtiger_Theme::getImagePath('LayoutEditor.gif'); 134 $editWorkflowsImagePath = Vtiger_Theme::getImagePath('EditWorkflows.png'); 135 $settingsLinks = array(); 136 137 if(VTWorkflowUtils::checkModuleWorkflow($this->getName())) { 138 $settingsLinks[] = array( 139 'linktype' => 'LISTVIEWSETTING', 140 'linklabel' => 'LBL_EDIT_WORKFLOWS', 141 'linkurl' => 'index.php?parent=Settings&module=Workflows&view=List&sourceModule='.$this->getName(), 142 'linkicon' => $editWorkflowsImagePath 143 ); 144 } 145 $settingsLinks[] = array( 146 'linktype' => 'LISTVIEWSETTING', 147 'linklabel' => 'LBL_EDIT_FIELDS', 148 'linkurl' => 'index.php?parent=Settings&module=LayoutEditor&sourceModule='.$this->getName(), 149 'linkicon' => $layoutEditorImagePath 150 ); 151 152 $settingsLinks[] = array( 153 'linktype' => 'LISTVIEWSETTING', 154 'linklabel' => 'LBL_EDIT_PICKLIST_VALUES', 155 'linkurl' => 'index.php?parent=Settings&module=Picklist&source_module='.$this->getName(), 156 'linkicon' => '' 157 ); 158 159 if($this->hasSequenceNumberField()) { 160 $settingsLinks[] = array( 161 'linktype' => 'LISTVIEWSETTING', 162 'linklabel' => 'LBL_MODULE_SEQUENCE_NUMBERING', 163 'linkurl' => 'index.php?parent=Settings&module=Vtiger&view=CustomRecordNumbering&sourceModule='.$this->getName(), 164 'linkicon' => '' 165 ); 166 } 167 168 return $settingsLinks; 169 } 170 } 171 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |