CRM_Core_BAO_File::deleteEntityFile($params['entityTable'], $params['entityID'], NULL, $params['fileID']);
}
-}
- }
+ /**
+ * function to display paper icon for a file attachment -- CRM-13624
+ *
+ * @param $entityTable string The entityTable to which the file is attached. eg "civicrm_contact", "civicrm_note", "civicrm_activity"
+ * @param $entityID int The id of the object in the above entityTable
+ *
+ * @return array|NULL list of HTML snippets; one HTML snippet for each attachment. If none found, then NULL
+ *
+ * @static
+ * @access public
+ */
+ static function paperIconAttachment( $entityTable, $entityID ) {
+ if (empty($entityTable) || !$entityID) {
+ $results = NULL;
+ return $results;
+ }
+ $currentAttachmentInfo = self::getEntityFile( $entityTable, $entityID );
+ foreach($currentAttachmentInfo as $fileKey => $fileValue) {
+ $fileID = $fileValue['fileID'];
+ $fileType = $fileValue['mime_type'];
+ $eid = $entityID;
+ if($fileID) {
+ if ($fileType == 'image/jpeg' ||
+ $fileType == 'image/pjpeg' ||
+ $fileType == 'image/gif' ||
+ $fileType == 'image/x-png' ||
+ $fileType == 'image/png'
+ ) {
+ $url = $fileValue['url'];
+ $alt = $fileValue['cleanName'];
+ $file_url[$fileID] = "
+ <a href=\"$url\" class='crm-image-popup'>
+ <div class='icon paper-icon' title=\"$alt\" alt=\"$alt\"></div>
+ </a>";
+ // for non image files
+ }
+ else {
+ $url = $fileValue['url'];
+ $alt = $fileValue['cleanName'];
+ $file_url[$fileID] = "<a href=\"$url\"><div class='icon paper-icon' title=\"$alt\" alt=\"$alt\"></div></a>";
+ }
+ }
+ }
+ if(empty($file_url)) {
+ $results = NULL;
+ }
+ else {
+ $results = $file_url;
+ }
+ return $results;
+ }
+
++}
}
if (!empty($tagset)) {
+ // assign current tagsets which is used in postProcess
+ $form->_tagsetInfo = $tagset;
+ $form->assign("tagsetType", $mode);
$form->assign("tagsetInfo_$mode", $tagset);
$form->assign("isTagset", TRUE);
}
* @return void
*/
static function queryObjects(&$queryObjects, $type = 'Contact') {
- return self::singleton()->invoke(2, $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects');
+ return self::singleton()->invoke(2, $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects');
}
+
+ /**
+ * This hook is called while viewing contact dashboard
+ *
+ * @param array $availableDashlets list of dashlets; each is formatted per api/v3/Dashboard
+ * @param array $activeDashlets list of dashlets; each is formatted per api/v3/DashboardContact
+ */
+ static function dashboard_defaults($availableDashlets, &$defaultDashlets) {
+ return self::singleton()->invoke(2, $availableDashlets, $defaultDashlets, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_dashboard_defaults');
+ }
}