Ejemplo n.º 1
0
function create_session($workflow_id)
{
    global $user;
    $create_new_session = false;
    $_SESSION['workflow_id'] = $workflow_id;
    if (Workflow_Users::doesWorkflowHaveUserName($workflow_id, $user->name)) {
        $apiary_session_base = $user->name . '_' . $workflow_id . '_';
        if (strpos($_SESSION['apiary_session_id'], $apiary_session_base) === false) {
            $create_new_session = true;
        } else {
            if (!Workflow_Sessions::session_id_exists($_SESSION['apiary_session_id'])) {
                $create_new_session = true;
            } else {
                if (!Workflow_Sessions::renew_session($_SESSION['apiary_session_id'])) {
                    $create_new_session = true;
                }
            }
        }
        if ($create_new_session) {
            if (!empty($_SESSION['apiary_session_id'])) {
                if (Workflow_Sessions::session_id_exists($_SESSION['apiary_session_id'])) {
                    Workflow_Sessions::delete($_SESSION['apiary_session_id']);
                }
            }
            $_SESSION['apiary_session_id'] = $apiary_session_base . date("YmdHis");
            Workflow_Sessions::create($_SESSION['apiary_session_id']);
        }
        echo $_SESSION['apiary_session_id'];
    } else {
        echo "false";
    }
}
Ejemplo n.º 2
0
function get_images_list($specimen_pid, $nothing, $workflow_id)
{
    global $user;
    if (Workflow_Users::doesWorkflowHaveUserName($workflow_id, $user->name) && Workflow_Permission::doesWorkflowHavePermission($workflow_id, "canAnalyzeSpecimen")) {
        $image_pids = AP_Specimen::getImageListForSpecimen($specimen_pid);
        echo json_encode($image_pids);
    }
}
Ejemplo n.º 3
0
 static function getUserList($workflow_id)
 {
     module_load_include('php', 'apiary_project', 'workflow/include/class.Workflow_Users');
     return Workflow_Users::getUserList($workflow_id);
 }
Ejemplo n.º 4
0
function template($param1, $param2, $workflow_id)
{
    global $user;
    $returnjs = "";
    if (Workflow_Users::doesWorkflowHaveUserName($workflow_id, $user->name) && Workflow_Permission::doesWorkflowHavePermission($workflow_id, "canTranscribe")) {
    } else {
        $returnjs .= "jQuery.jGrowl('Sorry! You do not have permission for this operation');";
    }
    echo $returnjs;
}
Ejemplo n.º 5
0
function reload_transcribe_text($roi_pid, $nothing, $workflow_id)
{
    global $user;
    $returnHTML = "";
    if (Workflow_Users::doesWorkflowHaveUserName($workflow_id, $user->name) && Workflow_Permission::doesWorkflowHavePermission($workflow_id, "canTranscribe")) {
        $roi_obj = new roiHandler($roi_pid);
        if ($roi_obj->ifExist("Text")) {
            $returnHTML = nl2br($roi_obj->getDatastream("Text"));
        }
    }
    echo $returnHTML;
}
Ejemplo n.º 6
0
 static function doesWorkflowHaveUserName($workflow_id, $user_name)
 {
     $user_id = Workflow_Users::getUserIDFromName($user_name);
     return Workflow_Users::doesWorkflowHaveUserID($workflow_id, $user_id);
 }
Ejemplo n.º 7
0
function drupal_user_cbox($workflow_id, $working_selected_user_csv)
{
    $working_selected_user_list = explode(",", $working_selected_user_csv);
    $drupal_user_name_list = Workflow::getDrupalUserList();
    //we can modify this to only return drupal users with certain permissions
    $drupal_user_count = sizeof($drupal_user_name_list);
    if ($workflow_id != '0') {
        if (Workflow::workflow_id_exists($workflow_id)) {
            $selected_user_list = Workflow_Users::getUserList($workflow_id);
        }
    } else {
        $selected_user_list = array($user->name);
    }
    for ($i = 0; $i < sizeof($working_selected_user_list); $i++) {
        if (array_search($working_selected_user_list[$i], $selected_user_list) > -1) {
            //do not do anything
        } else {
            array_push($selected_user_list, $working_selected_user_list[$i]);
        }
    }
    $drupal_user_names_combobox = generateDrupalUserNamesComboBox($drupal_user_name_list, $selected_user_list);
    $returnJSON['drupal_user_count'] = $drupal_user_count;
    $returnJSON['drupal_user_names_combobox'] = $drupal_user_names_combobox;
    echo json_encode($returnJSON);
}