Beispiel #1
0
 static function registerScripts()
 {
     static $loaded = FALSE;
     if ($loaded) {
         return;
     }
     $loaded = TRUE;
     CRM_Core_Resources::singleton()->addSettingsFactory(function () {
         $config = CRM_Core_Config::singleton();
         return array('PseudoConstant' => array('locationType' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), 'job_hours_time' => CRM_HRJob_Page_JobsTab::getJobHoursTime(), 'working_days' => CRM_HRJob_Page_JobsTab::getDaysPerTime()), 'FieldOptions' => CRM_HRJob_Page_JobsTab::getFieldOptions(), 'jobTabApp' => array('contact_id' => CRM_Utils_Request::retrieve('cid', 'Integer'), 'domain_id' => CRM_Core_Config::domainID(), 'isLogEnabled' => (bool) $config->logging, 'loggingReportId' => CRM_Report_Utils_Report::getInstanceIDForValue('logging/contact/summary'), 'currencies' => CRM_HRJob_Page_JobsTab::getCurrencyFormats(), 'defaultCurrency' => $config->defaultCurrency));
     })->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone/backbone.js', 120, 'html-header')->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.js', 125, 'html-header', FALSE)->addScriptFile('civicrm', 'packages/backbone/backbone.modelbinder.js', 125, 'html-header', FALSE)->addScriptFile('civicrm', 'js/jquery/jquery.crmRevisionLink.js', 125, 'html-header', FALSE)->addScriptFile('org.civicrm.hrjob', 'js/jquery/jquery.hrContactLink.js', 125, 'html-header', FALSE)->addScriptFile('org.civicrm.hrjob', 'js/jquery/jquery.hrFileLink.js', 125, 'html-header', FALSE)->addScriptFile('org.civicrm.hrjob', 'js/jquery/jquery.lockButton.js', 125, 'html-header', FALSE)->addScriptFile('civicrm', 'js/crm.backbone.js', 130, 'html-header', FALSE)->addStyleFile('org.civicrm.hrjob', 'css/hrjob.css', 140, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/hrapp.js', 150, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/renderutil.js', 155, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/entities/hrjob.js', 155, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/common/navigation.js', 155, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/common/mbind.js', 155, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/common/views.js', 155, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/jobtabapp.js', 160, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/jobtabapp/intro/show_controller.js', 160, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/jobtabapp/intro/show_views.js', 160, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/jobtabapp/tree/tree_controller.js', 160, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/jobtabapp/tree/tree_views.js', 160, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/jobtabapp/summary/summary_controller.js', 160, 'html-header')->addScriptFile('org.civicrm.hrjob', 'js/jobtabapp/summary/summary_views.js', 160, 'html-header');
     foreach (array('general', 'funding', 'health', 'hour', 'leave', 'pay', 'pension', 'role') as $module) {
         CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrjob', "js/jobtabapp/{$module}/edit_controller.js", 160, 'html-header')->addScriptFile('org.civicrm.hrjob', "js/jobtabapp/{$module}/edit_views.js", 160, 'html-header')->addScriptFile('org.civicrm.hrjob', "js/jobtabapp/{$module}/summary_views.js", 160, 'html-header');
     }
     $templateDir = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.hrjob') . '/templates/';
     $region = CRM_Core_Region::instance('page-header');
     foreach (glob($templateDir . 'CRM/HRJob/Underscore/*.tpl') as $file) {
         $fileName = substr($file, strlen($templateDir));
         $region->add(array('template' => $fileName));
     }
     $region->add(array('template' => 'CRM/Form/validate.tpl'));
 }
Beispiel #2
0
/**
 * Implementation of hook_civicrm_tabs
 */
function hrjob_civicrm_tabs(&$tabs, $contactID)
{
    if (!CRM_Core_Permission::check('edit HRJobs')) {
        return;
    }
    $contactType = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactID, 'contact_type', 'id');
    if ($contactType != 'Individual') {
        return;
    }
    CRM_HRJob_Page_JobsTab::registerScripts();
    $tab = array('id' => 'hrjob', 'url' => CRM_Utils_System::url('civicrm/contact/view/hrjob', array('cid' => $contactID, 'snippet' => 1)), 'title' => ts('Jobs'), 'weight' => 10, 'count' => CRM_HRJob_BAO_HRJob::getRecordCount(array('contact_id' => $contactID)));
    $tabs[] = $tab;
    CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrjob', 'js/hrjob.js');
    $selectedChild = CRM_Utils_Request::retrieve('selectedChild', 'String');
    CRM_Core_Resources::singleton()->addSetting(array('tabs' => array('selectedChild' => $selectedChild)));
}