本文整理汇总了PHP中data_entry_helper::relative_client_helper_path方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::relative_client_helper_path方法的具体用法?PHP data_entry_helper::relative_client_helper_path怎么用?PHP data_entry_helper::relative_client_helper_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::relative_client_helper_path方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getCacheFileName
private static function _getCacheFileName($userID)
{
/* If timeout is not set, we're not caching */
$path = data_entry_helper::$cache_folder ? data_entry_helper::$cache_folder : data_entry_helper::relative_client_helper_path() . 'cache/';
if (!is_dir($path) || !is_writeable($path)) {
return false;
}
return $path . 'cache_' . data_entry_helper::$website_id . '_CMS_User_List_' . $userID;
}
示例2: get_template_with_map
private static function get_template_with_map($args, $readAuth, $extraParams, $paramDefaults)
{
$r = '<div id="outer-with-map" class="ui-helper-clearfix">';
$r .= '<div id="grid" class="left" style="width:65%">{paramsForm}{grid}</div>';
$r .= '<div id="map-and-record" class="right" style="width: 34%"><div id="summary-map">';
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
// This is used for drawing, so need an editlayer, but not used for input
$options['editLayer'] = true;
$options['editLayerInSwitcher'] = true;
$options['clickForSpatialRef'] = false;
$options['featureIdField'] = 'occurrence_id';
$r .= map_helper::map_panel($options, $olOptions);
$reportMapOpts = array('dataSource' => !empty($args['mapping_report_name']) ? $args['mapping_report_name'] : $args['report_name'], 'mode' => 'report', 'readAuth' => $readAuth, 'autoParamsForm' => false, 'extraParams' => $extraParams, 'paramDefaults' => $paramDefaults, 'reportGroup' => 'verification', 'clickableLayersOutputMode' => 'report', 'rowId' => 'occurrence_id', 'sharing' => 'verification', 'ajax' => TRUE);
if (!empty($args['mapping_report_name_lores'])) {
$reportMapOpts['dataSourceLoRes'] = $args['mapping_report_name_lores'];
}
$r .= report_helper::report_map($reportMapOpts);
$r .= '</div>';
global $user;
if (function_exists('hostsite_get_user_field') && ($locationId = hostsite_get_user_field('location_expertise', false))) {
iform_map_zoom_to_location($locationId, $readAuth);
}
$r .= '<div id="record-details-wrap" class="ui-widget ui-widget-content">';
$r .= self::instructions('grid on the left');
$r .= '<div id="record-details-content" style="display: none">';
$r .= '<div id="record-details-toolbar">';
$r .= '<div id="verify-buttons">';
$r .= '<div id="verify-buttons-inner">';
$r .= '<label>' . lang::get('Actions:') . '</label>';
$imgPath = empty(data_entry_helper::$images_path) ? data_entry_helper::relative_client_helper_path() . "../media/images/" : data_entry_helper::$images_path;
$r .= '<button type="button" id="btn-verify" title="' . lang::get('Verify') . '"><img width="18" height="18" src="' . $imgPath . 'nuvola/ok-16px.png"/></button>';
$r .= '<button type="button" id="btn-edit-verify" title="' . lang::get('Edit determination then verify') . '"><img width="18" height="18" src="' . $imgPath . 'nuvola/package_editors-16px.png"/>' . '<img width="18" height="18" src="' . $imgPath . 'nuvola/ok-16px.png"/></button>';
$r .= '<button type="button" id="btn-reject" title="' . lang::get('Reject') . '"><img width="18" height="18" src="' . $imgPath . 'nuvola/cancel-16px.png"/></button>';
$r .= '<button type="button" id="btn-query" title="' . lang::get('Query') . '"><img width="18" height="18" src="' . $imgPath . 'nuvola/dubious-16px.png"/></button>';
$r .= '<div id="redet-dropdown-ctnr" style="display: none"><div id="redet-dropdown">';
$r .= data_entry_helper::species_autocomplete(array('fieldname' => 'redet', 'label' => lang::get('New determination'), 'labelClass' => 'auto', 'helpText' => lang::get('Enter a new determination for this record before verifying it. The previous determination will be stored with the record.'), 'cacheLookup' => true, 'extraParams' => $readAuth + array('taxon_list_id' => 1), 'speciesIncludeBothNames' => true, 'speciesIncludeTaxonGroup' => true));
$r .= '</div></div>';
$r .= '</div></div>';
$r .= '<label>Contact:</label>';
$r .= '<button type="button" id="btn-email-expert" class="default-button">' . lang::get('Another expert') . '</button>';
$r .= '<button type="button" id="btn-email-recorder" class="default-button">' . lang::get('Recorder') . '</button>';
$r .= '</div>';
$r .= '<div id="record-details-tabs">';
// note - there is a dependency in the JS that comments is the last tab and media the 2nd to last.
$r .= data_entry_helper::tab_header(array('tabs' => array('#details-tab' => lang::get('Details'), '#experience-tab' => lang::get('Experience'), '#phenology-tab' => lang::get('Phenology'), '#media-tab' => lang::get('Media'), '#comments-tab' => lang::get('Comments'))));
data_entry_helper::$javascript .= "indiciaData.detailsTabs = ['details','experience','phenology','media','comments'];\n";
data_entry_helper::enable_tabs(array('divId' => 'record-details-tabs'));
$r .= '<div id="details-tab"></div>';
$r .= self::other_tab_html();
$r .= '</div></div></div></div></div>';
return $r;
}
示例3: get_tab_content
protected static function get_tab_content($auth, $args, $tab, $tabContent, $tabalias, &$attributes, &$hasControls)
{
// cols array used if we find | splitters
$cols = array();
$defAttrOptions = array('extraParams' => $auth['read']);
if (isset($args['attribute_termlist_language_filter']) && $args['attribute_termlist_language_filter']) {
$defAttrOptions['language'] = iform_lang_iso_639_2($args['language']);
}
//create array of attribute field names to test against later
$attribNames = array();
foreach ($attributes as $key => $attrib) {
$attribNames[$key] = $attrib['id'];
}
$html = '';
// Now output the content of the tab. Use a for loop, not each, so we can treat several rows as one object
for ($i = 0; $i < count($tabContent); $i++) {
$component = trim($tabContent[$i]);
if (preg_match('/\\A\\?[^�]*\\?\\z/', $component) === 1) {
// Component surrounded by ? so represents a help text
$helpText = substr($component, 1, -1);
$html .= '<div class="page-notice ui-state-highlight ui-corner-all">' . lang::get($helpText) . "</div>";
} elseif (preg_match('/\\A\\[[^�]*\\]\\z/', $component) === 1) {
// Component surrounded by [] so represents a control or control block
// Anything following the component that starts with @ is an option to pass to the control
$options = array();
while ($i < count($tabContent) - 1 && substr($tabContent[$i + 1], 0, 1) == '@' || trim($tabContent[$i]) === '') {
$i++;
// ignore empty lines
if (trim($tabContent[$i]) !== '') {
$option = explode('=', substr($tabContent[$i], 1), 2);
if (!isset($option[1]) || $option[1] === 'false') {
$options[$option[0]] = FALSE;
} else {
$options[$option[0]] = json_decode($option[1], TRUE);
// if not json then need to use option value as it is
if ($options[$option[0]] == '') {
$options[$option[0]] = $option[1];
}
}
// urlParam is special as it loads the control's default value from $_GET
if ($option[0] === 'urlParam' && isset($_GET[$option[1]])) {
$options['default'] = $_GET[$option[1]];
}
}
}
// if @permission specified as an option, then check that the user has access to this control
if (!empty($options['permission']) && !user_access($options['permission'])) {
continue;
}
$parts = explode('.', str_replace(array('[', ']'), '', $component));
$method = 'get_control_' . preg_replace('/[^a-zA-Z0-9]/', '', strtolower($component));
if (!empty($args['high_volume']) && $args['high_volume']) {
// enable control level report caching when in high_volume mode
$options['caching'] = empty($options['caching']) ? true : $options['caching'];
$options['cachetimeout'] = empty($options['cachetimeout']) ? HIGH_VOLUME_CONTROL_CACHE_TIMEOUT : $options['cachetimeout'];
}
// allow user settings to override the control - see iform_user_ui_options.module
if (isset(data_entry_helper::$data['structureControlOverrides']) && !empty(data_entry_helper::$data['structureControlOverrides'][$component])) {
$options = array_merge($options, data_entry_helper::$data['structureControlOverrides'][$component]);
}
if (count($parts) === 1 && method_exists(self::$called_class, $method)) {
//outputs a control for which a specific output function has been written.
$html .= call_user_func(array(self::$called_class, $method), $auth, $args, $tabalias, $options);
$hasControls = true;
} elseif (count($parts) === 2) {
require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/' . data_entry_helper::relative_client_helper_path() . '/prebuilt_forms/extensions/' . $parts[0] . '.php';
if (method_exists('extension_' . $parts[0], $parts[1])) {
//outputs a control for which a specific extension function has been written.
$path = call_user_func(array(self::$called_class, 'getReloadPath'));
//pass the classname of the form through to the extension control method to allow access to calling class functions and variables
$args["calling_class"] = 'iform_' . self::$node->iform;
$html .= call_user_func(array('extension_' . $parts[0], $parts[1]), $auth, $args, $tabalias, $options, $path, $attributes);
$hasControls = true;
// auto-add JavaScript for the extension
if (file_exists(iform_client_helpers_path() . 'prebuilt_forms/extensions/' . $parts[0] . '.js')) {
drupal_add_js(iform_client_helpers_path() . 'prebuilt_forms/extensions/' . $parts[0] . '.js', array('preprocess' => FALSE));
}
if (file_exists(iform_client_helpers_path() . 'prebuilt_forms/extensions/' . $parts[0] . '.css')) {
drupal_add_css(iform_client_helpers_path() . 'prebuilt_forms/extensions/' . $parts[0] . '.css', array('preprocess' => FALSE));
}
} else {
$html .= lang::get("The {$component} extension cannot be found.");
}
} elseif (($attribKey = array_search(substr($component, 1, -1), $attribNames)) !== false || preg_match('/^\\[[a-zA-Z]+:(?P<ctrlId>[0-9]+)\\]/', $component, $matches)) {
// control is a smpAttr or other attr control.
if (empty($options['extraParams'])) {
$options['extraParams'] = array_merge($defAttrOptions['extraParams']);
} else {
$options['extraParams'] = array_merge($defAttrOptions['extraParams'], (array) $options['extraParams']);
}
//merge extraParams first so we don't loose authentication
$options = array_merge($defAttrOptions, $options);
foreach ($options as $key => &$value) {
$value = apply_user_replacements($value);
}
if ($attribKey !== false) {
// a smpAttr control
$html .= data_entry_helper::outputAttribute($attributes[$attribKey], $options);
$attributes[$attribKey]['handled'] = true;
} else {
//.........这里部分代码省略.........
示例4: send_file_to_warehouse
/**
* Takes a file that has been uploaded to the client website upload folder, and moves it to the warehouse upload folder using the
* data services.
*
* @param string $path Path to the file to upload, relative to the interim image path folder (normally the
* client_helpers/upload folder.
* @param boolean $persist_auth Allows the write nonce to be preserved after sending the file, useful when several files
* are being uploaded.
* @return string Error message, or true if successful.
*/
private static function send_file_to_warehouse($path, $persist_auth = false)
{
$interim_image_folder = isset(parent::$interim_image_folder) ? parent::$interim_image_folder : 'upload/';
$uploadpath = data_entry_helper::relative_client_helper_path() . $interim_image_folder;
$serviceUrl = parent::$base_url . "/index.php/services/data/handle_media";
// This is used by the file box control which renames uploaded files using a guid system, so disable renaming on the server.
$postargs = array('name_is_guid' => 'true');
// attach authentication details
if (array_key_exists('auth_token', $_POST)) {
$postargs['auth_token'] = $_POST['auth_token'];
}
if (array_key_exists('nonce', $_POST)) {
$postargs['nonce'] = $_POST['nonce'];
}
if ($persist_auth) {
$postargs['persist_auth'] = 'true';
}
$file_to_upload = array('media_upload' => '@' . realpath($uploadpath . $path));
$response = data_entry_helper::http_post($serviceUrl, $file_to_upload + $postargs);
$output = json_decode($response['output'], true);
$r = true;
// default is success
if (is_array($output)) {
//an array signals an error
if (array_key_exists('error', $output)) {
// return the most detailed bit of error information
if (isset($output['errors']['media_upload'])) {
$r = $output['errors']['media_upload'];
} else {
$r = $output['error'];
}
}
}
//remove local copy
//unlink(realpath($uploadpath.$path));
watchdog('file exists', realpath($uploadpath . $path));
return $r;
}
示例5: get_notifications_html
private static function get_notifications_html($auth, $sourceType, $website_id, $user_id, $options)
{
iform_load_helpers(array('report_helper'));
$imgPath = empty(data_entry_helper::$images_path) ? data_entry_helper::relative_client_helper_path() . "../media/images/" : data_entry_helper::$images_path;
$sendReply = $imgPath . "nuvola/mail_send-22px.png";
$cancelReply = $imgPath . "nuvola/mail_delete-22px.png";
//When the user wants to reply to a message, we have to add a new row
report_helper::$javascript .= "\n indiciaData.reply_to_message = function(notification_id, occurrence_id) {\n if (!\$('#reply-row-'+occurrence_id).length) {\n rowHtml = '<tr id='+\"reply-row-\"+occurrence_id+'><td><label for=\"\">" . lang::get('Enter your reply below') . ":</label><textarea style=\"width: 95%\" id=\"reply-' +occurrence_id+'\"></textarea></td>';\n rowHtml += '<td class=\"actions\">';\n rowHtml += '<div><img class=\"action-button\" src=\"{$sendReply}\" onclick=\"reply('+occurrence_id+','+notification_id+',true);\" title=\"Send reply\">';\n rowHtml += '<img class=\"action-button\" src=\"{$cancelReply}\" onclick=\"reply('+occurrence_id+','+notification_id+',false);\" title=\"Cancel reply\">';\n rowHtml += '</div></td></tr>';\n \$(rowHtml).insertAfter('tr#row'+notification_id);\n \$('tr#row'+notification_id+' .action-button').hide();\n }\n };\n\n ";
$urlParams = array('occurrence_id' => '{occurrence_id}');
if (!empty($_GET['group_id'])) {
$urlParams['group_id'] = $_GET['group_id'];
}
$availableActions = array(array('caption' => lang::get('Edit this record'), 'class' => 'edit-notification', 'url' => '{rootFolder}{editing_form}', 'urlParams' => $urlParams, 'img' => $imgPath . 'nuvola/package_editors-22px.png', 'visibility_field' => 'editable_flag'), array('caption' => lang::get('View this record'), 'class' => 'view-notification', 'url' => '{rootFolder}{viewing_form}', 'urlParams' => $urlParams, 'img' => $imgPath . 'nuvola/find-22px.png', 'visibility_field' => 'viewable_flag'), array('caption' => lang::get('Mark as read'), 'javascript' => 'remove_message({notification_id});', 'img' => $imgPath . 'nuvola/kmail-22px.png'));
//Only allow replying for 'user' messages.
if (isset($options['allowReply']) && $options['allowReply'] === true) {
$availableActions = array_merge($availableActions, array(array('caption' => lang::get('Reply to this message'), 'img' => $imgPath . 'nuvola/mail_reply-22px.png', 'visibility_field' => 'reply_flag', 'javascript' => "indiciaData.reply_to_message(" . '{notification_id}' . "," . '{occurrence_id}' . ");")));
}
$extraParams = array('user_id' => $user_id, 'system_name' => 'indicia', 'orderby' => 'triggered_on', 'sortdir' => 'DESC', 'default_edit_page_path' => $options['default_edit_page_path'], 'view_record_page_path' => $options['view_record_page_path'], 'website_id' => $website_id);
//Implode the source types so we can submit to the database in one text field.
if (!empty($sourceType)) {
$extraParams['source_types'] = "'" . implode("' ,'", $sourceType) . "'";
//If the user has supplied some config options for the different source types then we don't need the
// source filter drop down.
$extraParams['source_filter'] = 'all';
}
//Only include notifications associated with a set of recording group ids if option is supplied.
if (!empty($options['groupIds'])) {
$extraParams['group_ids'] = $options['groupIds'];
}
$columns = array('data' => array('fieldname' => 'data', 'json' => true, 'template' => '<div class="type-{source_type}"><div class="status-{record_status}"></div></div><div class="note-type-{source_type}">{comment}</div>' . '<div class="comment-from helpText" style="margin-left: 34px; display: block;">from {username} on {triggered_date}</div>', 'display' => 'Message'), 'occurrence_id' => array('fieldname' => 'occurrence_id'), 'actions' => array('actions' => $availableActions), 'triggered_date' => array('fieldname' => 'triggered_date', 'visible' => false));
// allow columns config to override our default setup
if (!empty($options['columns'])) {
foreach ($options['columns'] as $column) {
if (!empty($column['actions'])) {
$columns['actions'] = $column;
} elseif (!empty($column['fieldname'])) {
$columns[$column['fieldname']] = $column;
}
}
}
$r = report_helper::report_grid(array('id' => 'notifications-' . $options['id'], 'readAuth' => $auth['read'], 'itemsPerPage' => 10, 'dataSource' => 'library/notifications/notifications_list_for_notifications_centre', 'rowId' => 'notification_id', 'ajax' => true, 'mode' => 'report', 'extraParams' => $extraParams, 'paramDefaults' => array('source_filter' => 'all'), 'paramsFormButtonCaption' => lang::get('Filter'), 'columns' => array_values($columns)));
return $r;
}
示例6: get_control_surveys
/**
* Survey control that supports multiple surveys each with a date
*/
protected static function get_control_surveys($auth, $args, $tabalias, $options)
{
//Get the Delete icon for the Surveys Grid
$imgPath = empty(data_entry_helper::$images_path) ? data_entry_helper::relative_client_helper_path() . "../media/images/" : data_entry_helper::$images_path;
$deleteIcon = $imgPath . "delete.png";
//Pass the delete icon to javascript
data_entry_helper::$javascript .= "indiciaData.deleteImagePath='" . $deleteIcon . "';\n";
if (!empty($_GET['parent_id'])) {
$countUnitId = $_GET['parent_id'];
} else {
$countUnitId = $_GET['location_id'];
}
//Get the data for all surveys that are relevant
$surveysData = data_entry_helper::get_population_data(array('table' => 'survey', 'extraParams' => $auth['read'], 'nocache' => true, 'sharing' => $sharing));
//If we are in edit mode, then collect the data relating to the previously selected surveys, the ID and Date are
//held as JSON, so we need to decode it.
if ($countUnitId) {
$selectedSurveysData = data_entry_helper::get_population_data(array('table' => 'location_attribute_value', 'extraParams' => $auth['read'] + array('location_attribute_id' => $args['surveys_attribute_id'], 'location_id' => $countUnitId), 'nocache' => true, 'sharing' => $sharing));
if (!empty($selectedSurveysData)) {
foreach ($selectedSurveysData as $idx => $theSurveyData) {
$decodedSavedSurvey[$idx] = json_decode($theSurveyData['raw_value']);
$decodedSavedSurveyIds[$idx] = $decodedSavedSurvey[$idx][0];
}
}
}
//We need to populate the surveys drop-down but not include items that are already on the grid.
$r = '<div id="surveys-control">';
$r .= '<h3>Surveys</h3>';
$r .= '<label>Surveys: </label><select id = "survey-select">';
$r .= '<option id="please-select-surveys-item">Please Select</option>';
if (!empty($surveysData)) {
foreach ($surveysData as $surveyData) {
if (empty($decodedSavedSurveyIds) || !in_array($surveyData['id'], $decodedSavedSurveyIds)) {
$r .= '<option id="survey-select-' . $surveyData['id'] . '" value="' . $surveyData['id'] . '">' . $surveyData['title'] . '</option>';
}
//Get the names of the survey items in the grid and save them in an array where the ids are the keys - for use in a minute
if (!empty($decodedSavedSurveyIds)) {
if (in_array($surveyData['id'], $decodedSavedSurveyIds)) {
$surveyNameInGrid[$surveyData['id']]['title'] = $surveyData['title'];
}
}
}
}
$r .= '</select><br>';
$r .= data_entry_helper::date_picker(array_merge(array('label' => lang::get('LANG_Location_Surveys_Date'), 'fieldname' => 'survey:date'), $options));
$r .= '</br>';
$r .= '<input type="button" id="select-surveys-add" value="Add" onclick="select_survey_and_date();"><br>';
$r .= '<table id="surveys-table" id="surveys-table" border="3">' . '<tr>' . '<th>Survey Id</th>' . '<th>Survey Name</th>' . '<th>Date</th>' . '<th>Remove</th>' . '<th style="display:none;">Existing Attribute Id</th>' . '<th style="display:none;" type="hidden">Deleted</th></tr>' . '<tr>' . '</tr>';
if ($countUnitId) {
if (!empty($selectedSurveysData)) {
foreach ($selectedSurveysData as $idx => $theSurveyData) {
//Add a row to the grid of Selected Suveys and Dates for each existing survey that has been saved against the Count Unit
//Note we use the Survey Id on the end of the various html ids. The fields that will be used in submission also have a
//"name" otherwise they won't show in the submission $values variable
$r .= "\r\n <tr id='" . "selected-survey-row-" . $decodedSavedSurvey[$idx][0] . "'>\r\n <td>\r\n <input style='border: none;' id='" . "selected-survey-id-" . $decodedSavedSurvey[$idx][0] . "' name='" . "selected-survey-id-" . $decodedSavedSurvey[$idx][0] . "' value='" . $decodedSavedSurvey[$idx][0] . "' readonly>\r\n </td>\r\n <td>\r\n <input style='border: none;' id='" . "selected-survey-name-" . $decodedSavedSurvey[$idx][0] . "' value='" . $surveyNameInGrid[$decodedSavedSurvey[$idx][0]]['title'] . "' readonly>\r\n </td>\r\n <td>\r\n <input id='" . "selected-survey-date-" . $decodedSavedSurvey[$idx][0] . "' name='" . "selected-survey-date-" . $decodedSavedSurvey[$idx][0] . "' value='" . $decodedSavedSurvey[$idx][1] . "'>\r\n </td>\r\n <td>\r\n <img class=\"action-button\" src=\"{$deleteIcon}\" onclick=\"remove_survey_selection(" . $decodedSavedSurvey[$idx][0] . ",'" . $surveyNameInGrid[$decodedSavedSurvey[$idx][0]]['title'] . "');\" title=\"Delete Survey Selection\">\r\n </td>\r\n <td style='display:none;'>\r\n <input id='" . "selected-survey-existing-" . $decodedSavedSurvey[$idx][0] . "' name='" . "selected-survey-existing-" . $decodedSavedSurvey[$idx][0] . "' value='" . $theSurveyData['id'] . "'>\r\n </td>\r\n <td style='display:none;'>\r\n <input id='" . "selected-survey-deleted-" . $decodedSavedSurvey[$idx][0] . "' name='" . "selected-survey-deleted-" . $decodedSavedSurvey[$idx][0] . "' value='false'>\r\n </td>\r\n </tr>";
}
}
}
$r .= '</table>';
$r .= '</div>';
return $r;
}
示例7: get_notifications_html
private static function get_notifications_html($auth, $sourceType, $website_id, $user_id, $options)
{
iform_load_helpers(array('report_helper'));
global $auth;
$readNonce = $auth['nonce'];
$readAuthToken = $auth['auth_token'];
$imgPath = empty(data_entry_helper::$images_path) ? data_entry_helper::relative_client_helper_path() . "../media/images/" : data_entry_helper::$images_path;
$sendReply = $imgPath . "nuvola/mail_send-22px.png";
$cancelReply = $imgPath . "nuvola/mail_delete-22px.png";
//When the user wants to reply to a message, we have to add a new row
report_helper::$javascript .= "\n indiciaData.reply_to_message = function(notification_id, occurrence_id) {\n if (!\$('#reply-row-'+occurrence_id).length) {\n rowHtml = '<tr id='+\"reply-row-\"+occurrence_id+'><td><label for=\"\">" . lang::get('Enter your reply below') . ":</label><textarea style=\"width: 95%\" id=\"reply-' +occurrence_id+'\"></textarea></td>';\n rowHtml += '<td class=\"actions\">';\n rowHtml += '<div><img class=\"action-button\" src=\"{$sendReply}\" onclick=\"reply('+occurrence_id+','+notification_id+',true);\" title=\"Send reply\">';\n rowHtml += '<img class=\"action-button\" src=\"{$cancelReply}\" onclick=\"reply('+occurrence_id+','+notification_id+',false);\" title=\"Cancel reply\">';\n rowHtml += '</div></td></tr>';\n \$(rowHtml).insertAfter('tr#row'+notification_id);\n \$('tr#row'+notification_id+' .action-button').hide();\n }\n };\n\n ";
//Setup the javascript needed to support the remove notification button.
self::setup_source_types_hidden_fields($options, $sourceType, $website_id, $auth);
$auth = report_helper::get_read_auth(variable_get('indicia_website_id', ''), variable_get('indicia_password', ''));
//Implode the source types so we can submit to the database in one text field.
foreach ($sourceType as &$type) {
$type = "'" . $type . "'";
}
$sourceType = implode(',', $sourceType);
$availableActions = array(array('caption' => lang::get('Edit this record'), 'class' => 'edit-notification', 'url' => '{rootFolder}{editing_form}', 'urlParams' => array('occurrence_id' => '{occurrence_id}'), 'img' => $imgPath . 'nuvola/package_editors-22px.png', 'visibility_field' => 'editable_flag'), array('caption' => lang::get('View this record'), 'class' => 'view-notification', 'url' => '{rootFolder}{viewing_form}', 'urlParams' => array('occurrence_id' => '{occurrence_id}'), 'img' => $imgPath . 'nuvola/find-22px.png', 'visibility_field' => 'viewable_flag'), array('caption' => lang::get('Mark as read'), 'javascript' => 'remove_message({notification_id});', 'img' => $imgPath . 'nuvola/kmail-22px.png'));
//Only allow replying for 'user' messages.
if ($options['allowReply'] === true) {
$availableActions = array_merge($availableActions, array(array('caption' => lang::get('Reply to this message'), 'img' => $imgPath . 'nuvola/mail_reply-22px.png', 'javascript' => "indiciaData.reply_to_message(" . '{notification_id}' . "," . '{occurrence_id}' . ");")));
}
return report_helper::report_grid(array('id' => 'notifications-' . $options['id'], 'readAuth' => $auth, 'itemsPerPage' => 10, 'dataSource' => 'library/notifications/notifications_list_for_notifications_centre', 'rowId' => 'notification_id', 'ajax' => true, 'mode' => 'report', 'extraParams' => array('user_id' => $user_id, 'system_name' => 'indicia', 'source_types' => $sourceType, 'orderby' => 'triggered_on', 'sortdir' => 'DESC', 'default_edit_page_path' => $options['default_edit_page_path'], 'view_record_page_path' => $options['view_record_page_path'], 'website_id' => $website_id), 'columns' => array(array('fieldname' => 'data', 'json' => true, 'template' => '<div class="type-{source_type}"><div class="status-{record_status}"></div></div><div class="note-type-{source_type}">{comment}</div>' . '<div class="comment-from helpText" style="margin-left: 34px; display: block;">from {username} on {triggered_date}</div>', 'display' => 'Message'), array('actions' => $availableActions), array('fieldname' => 'triggered_date', 'visible' => false))));
}
示例8: get_comments
private static function get_comments($readAuth, $includeAddNew = true)
{
iform_load_helpers(array('data_entry_helper'));
$comments = data_entry_helper::get_population_data(array('table' => 'sample_comment', 'extraParams' => $readAuth + array('sample_id' => $_GET['sample_id'], 'sortdir' => 'DESC', 'orderby' => 'updated_on'), 'nocache' => true, 'sharing' => 'verification'));
$imgPath = empty(data_entry_helper::$images_path) ? data_entry_helper::relative_client_helper_path() . "../media/images/" : data_entry_helper::$images_path;
$r = '';
if (count($comments) === 0) {
$r .= '<p id="no-comments">' . lang::get('No comments have been made.') . '</p>';
}
$r .= '<div id="comment-list">';
foreach ($comments as $comment) {
$r .= '<div class="comment">';
$r .= '<div class="header">';
$r .= self::status_icons($comment['record_status'], $imgPath);
if ($comment['query'] === 't') {
$hint = lang::get('This is a query');
$r .= "<img width=\"12\" height=\"12\" src=\"{$imgPath}nuvola/dubious-16px.png\" title=\"{$hint}\" alt=\"{$hint}\"/>";
}
$r .= '<strong>' . (empty($comment['person_name']) ? $comment['username'] : $comment['person_name']) . '</strong> ';
$commentTime = strtotime($comment['updated_on']);
// Output the comment time. Skip if in future (i.e. server/client date settings don't match)
if ($commentTime < time()) {
$r .= self::ago($commentTime);
}
$r .= '</div>';
$c = str_replace("\n", '<br/>', $comment['comment']);
$r .= "<div>{$c}</div>";
$r .= '</div>';
}
$r .= '</div>';
if ($includeAddNew) {
$r .= '<form><fieldset><legend>' . lang::get('Add new comment') . '</legend>';
$r .= '<textarea id="comment-text"></textarea><br/>';
$r .= '<button type="button" class="default-button" onclick="saveComment(jQuery(\'#comment-text\').val());">' . lang::get('Save') . '</button>';
$r .= '</fieldset></form>';
}
return $r;
}
示例9: get_form
/**
* Return the Indicia form code
* @param array $args Input parameters.
* @param array $node Drupal node object
* @param array $response Response from Indicia services after posting.
* @return HTML string
*/
public static function get_form($args, $node, $response)
{
$r = "";
data_entry_helper::add_resource('jquery_ui');
if (isset($args['advancedUI']) && $args['advancedUI']) {
// TODO Sort out
// data_entry_helper::$resource_list['jquery_ui_slider'] =
// array('deps' => array('jquery_ui'), 'javascript' => array('/misc/ui/jquery.ui.slider.js'));
// data_entry_helper::add_resource('jquery_ui_slider');
// drupal_add_js(drupal_get_path('module', 'jquery_update') .'/replace/ui/ui/jquery.ui.slider.js');
// drupal_add_js('/misc/ui/jquery.ui.slider.min.js');
drupal_add_js('/misc/ui/jquery.ui.slider.js');
// drupal_add_js('/misc/ui/jquery.ui.button.min.js');
}
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
$now = new DateTime('now');
$year = isset($_REQUEST['year']) ? $_REQUEST['year'] : ($year = $now->format('Y'));
iform_load_helpers(array('report_helper', 'map_helper'));
$options = iform_report_get_report_options($args, $readAuth);
$currentParamValues = array();
if (isset($options['extraParams'])) {
foreach ($options['extraParams'] as $key => $value) {
// trim data to ensure blank lines are not handled.
$key = trim($key);
$value = trim($value);
// We have found a parameter, so put it in the request to the report service
if (!empty($key)) {
$currentParamValues[$key] = $value;
}
}
}
$extras = '&wantColumns=1&wantParameters=1&' . report_helper::array_to_query_string($currentParamValues, true);
$canIDuser = false;
// Report record should have location_id, sample_id, occurrence_id, sample_date, species ttl_id, attributes, geometry. created_by_id is optional
// Event definition: Name|attribute_id|attribute_values
// Loop through event definitions
/* $events = array(array('type'=>'arrayVal', 'name'=>'Budburst', 'attr'=>'289', 'values'=>array(3904,3961,3905,3906,3962,3907)),
array('type'=>'arrayVal', 'name'=>'Leaf', 'attr'=>'289', 'values'=>array(3906,3962,3907)),
array('type'=>'arrayVal', 'name'=>'Flowering', 'attr'=>'291', 'values'=>array(3912,3913,3914,3916,3917,3918)),
array('type'=>'presence', 'name'=>'Presence')); */
$events = str_replace("\r\n", "\n", $args['triggerEvents']);
$events = str_replace("\r", "\n", $events);
$events = explode("\n", trim($events));
foreach ($events as $idx => $event) {
$events[$idx] = explode(':', $event);
}
$triggerEvents = array();
$SpeciesEventSelections = array();
$Species = array();
$r .= '<div id="errorMsg"></div>' . '<table class="ui-widget ui-widget-content ui-corner-all controls-table" id="controls-table">' . '<thead class="ui-widget-header">' . '<tr><th><label for="yearControl">' . lang::get("Year") . ' : </label><select id="yearControl" name="year">';
for ($i = $now->format('Y'); $i >= $args['first_year']; $i--) {
$r .= '<option value="' . $i . '">' . $i . '</option>';
}
$r .= '</select></th>' . '<th><label for="speciesControl">' . lang::get("Species") . ' : </label><select id="speciesControl"><option value="">' . lang::get("Please select species") . '</option></select></th>' . '<th><label for="eventControl">' . lang::get("Event") . ' : </label><select id="eventControl"><option value="">' . lang::get("Please select event") . '</option>';
foreach ($events as $index => $event) {
$r .= '<option value="' . $index . '">' . $event[0] . '</option>';
$triggerEvents[] = '{"name":"' . $event[0] . '","type":"' . $event[1] . '"' . (count($event) > 2 ? ',"attr":' . $event[2] . ',"values":[' . $event[3] . ']' : '') . '}';
}
$r .= "</select></th>\n";
if (isset($args['twinMaps']) && $args['twinMaps']) {
$r .= '<th><label for="rhsCtrl">' . lang::get("Compare") . ' : </label><select id="rhsCtrl" name="rhsCtrl"><option value="">' . lang::get("Please select.") . '</option><option value="Test">' . lang::get("Test.") . "</option></select></th>\n";
}
$r .= '</tr></thead></table>' . "\n";
$args['map_width'] = "auto";
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
$options['editLayer'] = false;
$options['clickForSpatialRef'] = false;
$options['scroll_wheel_zoom'] = false;
$r .= '<div class="leftMap mapContainers leftMapOnly">' . map_helper::map_panel($options, $olOptions) . '</div>';
$options['divId'] = 'map2';
if (isset($args['twinMaps']) && $args['twinMaps']) {
$r .= '<div class="rightMap mapContainers leftMapOnly">' . map_helper::map_panel($options, $olOptions) . '</div>';
}
$r .= '<div class="ui-helper-clearfix"></div><div id="timeControls">' . (isset($args['advancedUI']) && $args['advancedUI'] ? '<div id="timeSlider"></div>' : '') . '<div id="toolbar">' . '<span id="dotControlLabel">' . lang::get('Dot Size') . ' :</span>' . (isset($args['advancedUI']) && $args['advancedUI'] ? '<div id="dotSlider"></div>' : '<select id="dotSelect"><option>2</option><option>3</option><option>4</option><option>5</option></select>') . '<button id="beginning">go to beginning</button><button id="playMap">play</button><button id="end">go to end</button>' . '<span id="dateControlLabel">' . lang::get("Date Currently displayed") . ' : ' . (isset($args['advancedUI']) && $args['advancedUI'] ? '<span id="displayDate" ></span>' : '<select id="timeSelect"><option value="">' . lang::get("Please select date") . '</option></select>') . '</span>' . '</div>';
$imgPath = empty(data_entry_helper::$images_path) ? data_entry_helper::relative_client_helper_path() . "../media/images/" : data_entry_helper::$images_path;
data_entry_helper::$javascript .= "\ninitTreeMap2({\n advanced_UI: " . (isset($args['advancedUI']) && $args['advancedUI'] ? "true" : "false") . ",\n dotSize: " . $args['dotSize'] . ",\n lat: " . $args['map_centroid_lat'] . ",\n long: " . $args['map_centroid_long'] . ",\n zoom: " . $args['map_zoom'] . ",\n triggerEvents: [" . implode(',', $triggerEvents) . "],\n base_url: '" . data_entry_helper::$base_url . "',\n report_name: '" . $args['report_name'] . "',\n auth_token: '" . $readAuth['auth_token'] . "',\n nonce: '" . $readAuth['nonce'] . "',\n reportExtraParams: '" . $extras . "',\n indicia_user_id: " . (hostsite_get_user_field('indicia_user_id') ? hostsite_get_user_field('indicia_user_id') : 'false') . ",\n timeControlSelector: '" . (isset($args['advancedUI']) && $args['advancedUI'] ? '#timeSlider' : '#timeSelect') . "',\n dotControlSelector: '" . (isset($args['advancedUI']) && $args['advancedUI'] ? '#dotSlider' : '#dotSelect') . "',\n timerDelay: " . (int) 1000 / $args['frameRate'] . ",\n twinMaps: " . (isset($args['twinMaps']) && $args['twinMaps'] ? 'true' : 'false') . ",\n imgPath: '" . $imgPath . "'\n});\n";
$r .= '</div>';
return $r;
}
示例10: _getCacheFileName
private static function _getCacheFileName()
{
$cacheFolder = data_entry_helper::relative_client_helper_path() . (isset(data_entry_helper::$cache_folder) ? data_entry_helper::$cache_folder : 'cache/');
if (!is_dir($cacheFolder) || !is_writeable($cacheFolder)) {
return false;
}
return $cacheFolder . 'cache_CMS_User_List';
}
示例11: report_calendar_summary2
//.........这里部分代码省略.........
$rawTab .= '<th>' . (isset($options['linkURL']) && $options['linkURL'] != '' ? '<a href="' . $options['linkURL'] . $sample['id'] . '" target="_blank" title="Link to data entry form for ' . $sample['location'] . ' on ' . $sample['date'] . ' (Sample ID ' . $sample['id'] . ')">' : '') . $sample_date->format('M') . '<br/>' . $sample_date->format('d') . (isset($options['linkURL']) && $options['linkURL'] != '' ? '</a>' : '') . '</th>';
$rawDataDownloadGrid .= ',' . $sample['date'];
}
$rawDataDownloadGrid .= "\n";
$rawTab .= '</tr></thead><tbody>';
if ($sampleFields) {
foreach ($sampleFields as $sampleField) {
// last-sample-datarow
$rawTab .= '<tr class="sample-datarow ' . ($altRow ? $options['altRowClass'] : '') . '"><td class="freeze-first-col">' . $sampleField['caption'] . '</td>';
$rawDataDownloadGrid .= '"' . $sampleField['caption'] . '",';
foreach ($sampleDateList as $sample) {
$rawTab .= '<td>' . ($sample[$sampleField['caption']] === null || $sample[$sampleField['caption']] == '' ? ' ' : $sample[$sampleField['caption']]) . '</td>';
$rawDataDownloadGrid .= ',' . $sample[$sampleField['caption']];
}
$rawTab .= '</tr>';
$rawDataDownloadGrid .= "\n";
$altRow = !$altRow;
}
data_entry_helper::$javascript .= "var sampleDatarows = \$('#rawData .sample-datarow').length;\n\$('#rawData .sample-datarow').eq(sampleDatarows-1).addClass('last-sample-datarow');\n";
}
foreach ($sortData as $sortedTaxon) {
$seriesID = $sortedTaxon[1];
// this is the meaning id
if (!empty($seriesLabels[$seriesID])) {
$rawTab .= '<tr class="datarow ' . ($altRow ? $options['altRowClass'] : '') . '"><td class="freeze-first-col"' . (isset($seriesLabels[$seriesID]['preferred']) ? ' title="' . $seriesLabels[$seriesID]['preferred'] . '"' : '') . '>' . $seriesLabels[$seriesID]['label'] . '</td>';
$rawDataDownloadGrid .= '"' . $seriesLabels[$seriesID]['label'] . '","' . (isset($seriesLabels[$seriesID]['preferred']) ? $seriesLabels[$seriesID]['preferred'] : '') . '",';
foreach ($sampleList as $sampleID) {
$rawTab .= '<td>' . (isset($rawArray[$sampleID][$seriesID]) ? $rawArray[$sampleID][$seriesID] : ' ') . '</td>';
$rawDataDownloadGrid .= ',' . (isset($rawArray[$sampleID][$seriesID]) ? $rawArray[$sampleID][$seriesID] : '');
}
$rawTab .= '</tr>';
$rawDataDownloadGrid .= "\n";
$altRow = !$altRow;
}
}
$rawTab .= '</tbody></table></div></div>';
}
}
}
} else {
$rawTab = "<p>Raw Data is only available when a location is specified.</p>";
}
$hasData = count($summaryArray) > 0;
$tabs = array('#summaryData' => lang::get('Summary Table'));
if ($hasData) {
$tabs = array_merge($tabs, array('#summaryChart' => lang::get('Summary Chart'), '#estimateData' => lang::get('Estimate Table'), '#estimateChart' => lang::get('Estimate Chart')));
}
$tabs['#rawData'] = lang::get('Raw Data');
$downloadTab = "";
$timestamp = isset($options['includeReportTimeStamp']) && $options['includeReportTimeStamp'] ? '_' . date('YmdHis') : '';
unset($options['extraParams']['orderby']);
// may have been set for raw data
// No need for saved reports to be atomic events. Will be purged automatically.
global $base_url;
$cacheFolder = data_entry_helper::$cache_folder ? data_entry_helper::$cache_folder : data_entry_helper::relative_client_helper_path() . 'cache/';
if ($hasData && $options['includeSummaryGridDownload']) {
$cacheFile = $options['downloadFilePrefix'] . 'summaryDataGrid' . $timestamp . '.csv';
$handle = fopen($cacheFolder . $cacheFile, 'wb');
fwrite($handle, $summaryDataDownloadGrid);
fclose($handle);
$downloadTab .= '<tr><td>' . lang::get('Download Summary Grid (CSV Format)') . ' : </td><td><a target="_blank" href="' . $base_url . '/' . drupal_get_path('module', 'iform') . '/client_helpers/cache/' . $cacheFile . '" download type="text/csv"><button type="button">' . lang::get('Download') . '</button></a></td></tr>' . "\n";
}
if ($hasData && $options['includeEstimatesGridDownload']) {
$cacheFile = $options['downloadFilePrefix'] . 'estimateDataGrid' . $timestamp . '.csv';
$handle = fopen($cacheFolder . $cacheFile, 'wb');
fwrite($handle, $estimateDataDownloadGrid);
fclose($handle);
$downloadTab .= '<tr><td>' . lang::get('Download Estimates Grid (CSV Format)') . ' : </td><td><a target="_blank" href="' . $base_url . '/' . drupal_get_path('module', 'iform') . '/client_helpers/cache/' . $cacheFile . '" download type="text/csv"><button type="button">' . lang::get('Download') . '</button></a></td></tr>' . "\n";
}
if ($hasRawData && $options['includeRawGridDownload']) {
$cacheFile = $options['downloadFilePrefix'] . 'rawDataGrid' . $timestamp . '.csv';
$handle = fopen($cacheFolder . $cacheFile, 'wb');
fwrite($handle, $rawDataDownloadGrid);
fclose($handle);
$downloadTab .= '<tr><td>' . lang::get('Download Raw Data Grid (CSV Format)') . ' : </td><td><a target="_blank" href="' . $base_url . '/' . drupal_get_path('module', 'iform') . '/client_helpers/cache/' . $cacheFile . '" download type="text/csv"><button type="button">' . lang::get('Download') . '</button></a></td></tr>' . "\n";
}
if ($hasData && count($options['downloads']) > 0) {
// format is assumed to be CSV
global $indicia_templates;
$indicia_templates['report_download_link'] = '<a target="_blank" href="{link}" download ><button type="button">' . lang::get('Download') . '</button></a>';
$downloadOptions = array('readAuth' => $options['readAuth'], 'extraParams' => array_merge($options['extraParams'], array('date_from' => $options['date_start'], 'date_to' => $options['date_end'])), 'itemsPerPage' => false);
// there are problems dealing with location_list as an array if empty, so connvert
if ($downloadOptions['extraParams']['location_list'] == "") {
$downloadOptions['extraParams']['location_list'] = "(-1)";
} else {
$downloadOptions['extraParams']['location_list'] = '(' . $downloadOptions['extraParams']['location_list'] . ')';
}
foreach ($options['downloads'] as $download) {
$downloadOptions['dataSource'] = $download['dataSource'];
$downloadOptions['filename'] = $download['filename'];
$downloadTab .= '<tr><td>' . $download['caption'] . ' : </td><td>' . report_helper::report_download_link($downloadOptions) . '</td></tr>';
}
}
if ($downloadTab != "") {
$tabs['#dataDownloads'] = lang::get('Downloads');
}
$r .= '<div id="controls">' . data_entry_helper::enable_tabs(array('divId' => 'controls')) . data_entry_helper::tab_header(array('tabs' => $tabs)) . ($hasData ? '<div id="summaryData">' . $summaryTab . '</div>' . '<div id="summaryChart"><div id="' . $options['chartID'] . '-summary" style="height:' . $options['height'] . 'px;' . (isset($options['width']) && $options['width'] != '' ? 'width:' . $options['width'] . 'px;' : '') . '"></div>' . $summarySeriesPanel . '</div>' . '<div id="estimateData">' . $estimateTab . '</div>' . '<div id="estimateChart"><div id="' . $options['chartID'] . '-estimates" style="height:' . $options['height'] . 'px;' . (isset($options['width']) && $options['width'] != '' ? 'width:' . $options['width'] . 'px;' : '') . '"></div>' . $summarySeriesPanel . '</div>' : '<div id="summaryData"><p>' . lang::get('No data available for this period with these filter values.') . '</p></div>') . '<div id="rawData">' . $rawTab . '</div>' . ($downloadTab != "" ? '<div id="dataDownloads"><table><tbody style="border:none;">' . $downloadTab . '</tbody></table></div>' : '') . '</div>';
$warnings .= '<span style="display:none;">Finish report_calendar_summary : ' . date(DATE_ATOM) . '</span>' . "\n";
return $warnings . $r;
}