Пример #1
0
		}
		$sql_search_count .=  " group by i.id";
		$params['mode'] = $mode;
		$params['sort_field_num'] = $sort_field_num;
		$params['sort_mode'] = $sort_mode;
		$params['count_object_custom_fields'] =$count_object_custom_fields;
		$params['last_update'] = $last_update;
		$params['block_size'] = $block_size;
	}

if (!$pure) {
	echo '<form id="tree_search" method="post" onsubmit="tree_search_submit();return false">';
		//field object types
		$select_object = '<div class = "divform">';
			$select_object .= '<table class="search-table"><tr><td>';
				$objects_type = get_object_types ();
				$objects_type[-1] = __('All');
				$select_object .= print_label (__('Object type'), '','',true);
				$select_object .= print_select($objects_type, 'id_object_type_search', $params['id_object_type_search'], 'change_object_type();', '', '', true, 4, false, false, false, '');
			$select_object .= '</td></tr></table>';
		$select_object .= '</div>';
		
		print_container_div("inventory_type_object",__("Select type object").print_help_tip (__("Select ALL to see all objects"), true),$select_object, 'open', false, false);

		//field label object types
		$select_label_object = '<div class = "divform" id = "pr">';
			$select_label_object .= '<table class="search-table"><tr><td>';
				$select_label_object .= print_label (__('Object fields').'<span id="object_fields_select_all"><a href="javascript: select_all_object_field()" >'.__('Select all').'</a><span>', '','',true);
				$select_label_object .= '<div id = "object_fields_search_check" class="div_multiselect" >';
				//checkbox id
				if ($params['object_fields'][0]){
Пример #2
0
function inventories_print_tree($sql_search, $sql_search_obj_type, $last_update = 0)
{
    global $config;
    global $enteprise_load;
    echo '<table class="search-table" style="width:99%">';
    echo '<tr><td style="width:100%" valign="top">';
    echo "<em style='float: right; padding-right: 20px;'>" . __("Using tree view");
    echo print_help_tip(__("Filters only apply <br> to the first level"), true);
    echo "</em>";
    if (!$sql_search_obj_type) {
        $object_types = get_object_types(false, true);
    } else {
        $object_types = get_db_all_rows_sql($sql_search_obj_type);
    }
    $sql_search = base64_encode($sql_search);
    if (empty($object_types)) {
        $object_types = array();
    }
    $elements_type = array();
    foreach ($object_types as $key => $type) {
        $elements_type[$key]['name'] = $type['name'];
        if ($type['icon']) {
            $elements_type[$key]['img'] = print_image("images/objects/" . $type['icon'], true, array("style" => 'vertical-align: middle;'));
        }
        $elements_type[$key]['id'] = $type['id'];
    }
    $elements_type[$key + 1]['name'] = __('No object type');
    $elements_type[$key + 1]['img'] = print_image("images/objects/box.png", true, array("style" => 'vertical-align: middle;'));
    $elements_type[$key + 1]['id'] = 0;
    echo "<ul style='margin: 0; margin-top: 20px; padding: 0;'>\n";
    $first = true;
    //Clean element based on ACLs
    $aux_elems = array();
    foreach ($elements_type as $elem) {
        $count_inventories = 0;
        // if ($enteprise_load !== ENTERPRISE_NOT_HOOK) {
        // 	$count_inventories = inventory_get_count_inventories($elem['id'], base64_decode($sql_search), $config['id_user']); //count
        // } else {
        // 	$count_inventories = inventories_get_count_inventories_for_tree($elem['id'], base64_decode($sql_search)); //count
        // }
        // if ($count_inventories) {
        // 	array_push($aux_elems, $elem);
        // }
        array_push($aux_elems, $elem);
    }
    $elements_type = $aux_elems;
    $i = 0;
    $end = 0;
    $margin_left_ref = 23;
    foreach ($elements_type as $element) {
        $lessBranchs = 0;
        if ($element == end($elements_type)) {
            $end = 1;
        }
        $img_id = 'tree_image' . $i . '_object_types_' . $element["id"];
        if ($first) {
            if ($element != end($elements_type)) {
                $img = print_image("images/tree/first_closed.png", true, array("style" => 'vertical-align: middle;', "id" => $img_id, "pos_tree" => "0"));
                $first = false;
            } else {
                $lessBranchs = 1;
                $img = print_image("images/tree/one_closed.png", true, array("style" => 'vertical-align: middle;', "id" => $img_id, "pos_tree" => "1"));
            }
        } else {
            if ($element != end($elements_type)) {
                $img = print_image("images/tree/closed.png", true, array("style" => 'vertical-align: middle;', "id" => $img_id, "pos_tree" => "2"));
            } else {
                $lessBranchs = 1;
                $img = print_image("images/tree/last_closed.png", true, array("style" => 'vertical-align: middle;', "id" => $img_id, "pos_tree" => "3"));
            }
        }
        if ($enteprise_load !== ENTERPRISE_NOT_HOOK) {
            $inventories_stock = inventory_get_count_inventories($element['id'], base64_decode($sql_search), $config['id_user'], true, $last_update);
            //all inventories to calculate stock
        } else {
            $inventories_stock = inventories_get_count_inventories_for_tree($element['id'], base64_decode($sql_search), true, $last_update);
            //all inventories to calculate stock
        }
        // STOCK
        $total_stock = inventories_get_total_stock($inventories_stock);
        $unused_stock = inventories_get_stock($inventories_stock, 'unused');
        $new_stock = inventories_get_stock($inventories_stock, 'new');
        $min_stock = get_db_value('min_stock', 'tobject_type', 'id', $element['id']);
        if ($element['id'] == 0) {
            //no type
            $min_stock = 0;
        }
        $color_div = 'no_error_stock';
        if ($total_stock < $min_stock) {
            $color_div = 'error_stock';
            $min_stock = "<font color='#FF000'>" . $min_stock . "</font>";
        }
        $id_div = "object_types_" . $element['id'];
        echo "<li style='margin: 0px 0px 0px 0px;'>\n\t\t\t<a style='vertical-align: middle;' onfocus='JavaScript: this.blur()' href='javascript: loadSubTree(\"object_types\", \"" . $element['id'] . "\", " . $lessBranchs . ", \"\" ,\"" . $sql_search . "\", \"" . $i . "\", \"" . $end . "\", \"" . $last_update . "\")'>" . $img . "&nbsp;" . $element["img"] . "&nbsp;" . safe_output($element['name']) . "</a>" . "&nbsp;&nbsp;" . "({$total_stock}:{$new_stock}:{$unused_stock}:{$min_stock})" . print_help_tip(__("Total") . ':' . __("New") . ':' . __("Unused") . ':' . __("Min. stock"), true);
        if ($end) {
            echo "<div hiddenDiv='1' loadDiv='0' class='tree_view' id='tree_div" . $i . "_object_types_" . $element["id"] . "'></div>";
        } else {
            echo "<div hiddenDiv='1' loadDiv='0' class='tree_view tree_view_branch' id='tree_div" . $i . "_object_types_" . $element["id"] . "'></div>";
        }
        echo "</li>\n";
        $i++;
    }
    echo "</ul>\n";
    echo '</td>';
    echo '</tr>';
    echo '</table>';
    return;
}
Пример #3
0
            $spans = get_ne_entities_by_book($book_id, $_SESSION['user_id'], $tagset_id);
            $spans = array_unique(array_map(function ($span) {
                $tokens = '';
                foreach ($span['tokens'] as $t) {
                    $tokens .= $t[1] . ' ';
                }
                return trim($tokens);
            }, $spans));
            $book['all_spans'] = $spans;
        }
        $smarty->assign('book', $book);
        $smarty->assign('use_fast_mode', OPTION(OPT_NE_QUICK));
        $smarty->assign('possible_guidelines', array(1 => "Default (2014)", 2 => "Dialogue Eval (2016)"));
        $smarty->assign('current_guideline', OPTION(OPT_NE_TAGSET));
        $smarty->assign('entity_types', get_ne_types($tagset_id));
        $smarty->assign('mention_types', get_object_types($tagset_id));
        $smarty->assign('is_moderator', $is_book_moderator);
        $smarty->display('ner/book.tpl');
    } else {
        throw new UnexpectedValueException();
    }
} else {
    switch ($action) {
        case 'add':
            $book_name = trim($_POST['book_name']);
            $book_parent = $_POST['book_parent'];
            $book_id = books_add($book_name, $book_parent);
            if (isset($_POST['goto'])) {
                header("Location:books.php?book_id={$book_id}");
            } else {
                header("Location:books.php?book_id={$book_parent}");
 /**
  * @covers \get_object_types
  * @covers ::__invoke
  * @covers ::from
  * @covers ::getObjectConditionalTypes
  * @dataProvider provideDataToTest
  */
 public function testCanCallAsFunction($data, $expectedTypes)
 {
     // ----------------------------------------------------------------
     // setup your test
     // ----------------------------------------------------------------
     // perform the change
     $actualTypes = get_object_types($data);
     // ----------------------------------------------------------------
     // test the results
     $this->assertEquals($expectedTypes, $actualTypes);
 }