예제 #1
0
function ach_render_obj_list($obj)
{
    $html = "<center><table width='90%'>";
    $i = 0;
    $skip = false;
    while ($obj->hasNext()) {
        #foreach($obj as $elem) {
        $elem = $obj->getNext();
        if ($i % 2 == 0) {
            $html .= "<tr>";
        }
        switch ($elem->getDisplay()) {
            case "meta":
                $html .= "<td width='50%'>" . ach_render_obj_meta($elem) . "</td>";
                break;
            case "value":
                if ($i % 2 == 1) {
                    $html .= "</tr><tr>";
                }
                $html .= "<td colspan='2' width='100%'><center>" . ach_render_obj_value($elem) . "</center></td>";
                $i++;
                break;
            case "simple":
                $html .= "<td width='50%'>" . ach_render_obj_simple($elem) . "</td>";
                break;
            case "hidden":
            default:
                //do nothing
                $skip = true;
                break;
        }
        if ($i % 2 == 1) {
            $html .= "</tr>";
        }
        if (!$skip) {
            $i++;
        }
        $skip = false;
    }
    if ($i % 2 == 1) {
        $html .= "</tr>";
    }
    $html .= "</table></center>";
    return $html;
}
예제 #2
0
function ach_render_obj_list($obj, $task)
{
    #return null;
    global $metalist;
    $html = "<center><table width='90%'>";
    #$i = 0;
    #$skip = false;
    while ($obj->hasNext()) {
        #foreach($obj as $elem) {
        $inh = "";
        $elem = $obj->getNext();
        if ($task->isInherited($elem->getID())) {
            $inh = "<i>inherited</i>:&nbsp;";
        }
        #if(($i%2) == 0) {
        $html .= "<tr><td><table><tr>";
        #}
        switch ($elem->getDisplay()) {
            case "meta":
                $html .= "<td>" . $inh . ach_render_obj_meta($elem) . "<td>";
                break;
            case "value":
                #if(($i%2) == 1) {
                #	$html .= "</tr><tr>";
                #}
                $html .= "<td>" . $inh . ach_render_obj_value($elem) . "</td>";
                #$i++;
                break;
            case "simple":
                $html .= "<td>" . $inh . ach_render_obj_simple($elem) . "</td>";
                break;
            case "hidden":
            default:
                //do nothing
                #$skip = true;
                #if(($i%2) == 1) {
                #	$html .= "</tr><tr>";
                #}
                $html .= "<td>" . $inh . ach_render_obj_hidden($elem) . "</td>";
                #$i++;
                break;
        }
        $html .= "<td style='background-color:#FFFFFF;padding:3px;'><nobr><a href='javascript:hs(\"edit_obj_" . $elem->getID() . "\",\"block\");'><img src='pic/icon_edit.gif'></a>";
        #$html .= "&nbsp;<a href='javascript:hs(\"edit_obj_".$elem->getID()."\",\"block\");'><img src='pic/b_insrow.png'></a>";
        $html .= "&nbsp;&nbsp;&nbsp;<a href='?mode=ach&cat=" . $_REQUEST['cat'] . "&confirm=delete&id=" . $elem->getPathID() . "'><img src='pic/b_drop.png'></a></nobr></td>\n\t\t\t\t\t\t\t\t\t</td></tr></table>";
        $html .= "<div id='edit_obj_" . $elem->getID() . "' style='margin-bottom:3px;margin-top:3px;display:none;color:#000000;background-color:#FFFFFF;'>\n\t\t\t\t\t\t<form method='post' action='?mode=ach&cat=" . $_REQUEST['cat'] . "&id=" . $elem->getPathID() . "&act=obj_update#task_" . $elem->getTask() . "'>\n\t\t\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t\t\t<legend>edit objective</legend>\n\t\t\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td class='bw'>name:</td>\n\t\t\t\t\t\t\t\t\t\t<td><input type='text' name='aol_name' value='" . htmlspecialchars($elem->getName(), ENT_QUOTES) . "' /></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td class='bw'>type:</td>\n\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t<select name='ao_display'>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value='simple'";
        if ($elem->getDisplay() == "simple") {
            $html .= " selected='selected'";
        }
        $html .= ">simple</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value='hidden'";
        if ($elem->getDisplay() == "hidden") {
            $html .= " selected='selected'";
        }
        $html .= ">hidden</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value='value'";
        if ($elem->getDisplay() == "value") {
            $html .= " selected='selected'";
        }
        $html .= ">value / progressbar</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value='meta'";
        if ($elem->getDisplay() == "meta") {
            $html .= " selected='selected'";
        }
        $html .= ">meta</option>\n\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td class='bw'>trigger condition:</td>\n\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t<select name='ao_condition'>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value='all'";
        if ($elem->getCondition() == "all") {
            $html .= " selected='selected'";
        }
        $html .= ">require all</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value='any'";
        if ($elem->getCondition() == "any") {
            $html .= " selected='selected'";
        }
        $html .= ">require any</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value='value'";
        if ($elem->getCondition() == "value") {
            $html .= " selected='selected'";
        }
        $html .= ">value / progressbar</option>\n\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td class='bw'>trigger value:</td>\n\t\t\t\t\t\t\t\t\t\t<td><input type='text' name='ao_value' value='" . htmlspecialchars($elem->getValue(), ENT_QUOTES) . "' /></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td class='bw'>metalink:</td>\n\t\t\t\t\t\t\t\t\t\t<td><select name='ao_metalink'>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=''> -- none --</option>";
        /*$m = $menu->getIterator();
        												while($m->hasNext()) {
        													$n = $m->getNext();
        													$html .= "<option value='' disabled='disabled'>".$n->getName()."</option>";
        
        													$m2 = $n->getIterator();
        													while($m2->hasNext()) {
        														$n2 = $m2->getNext();
        														$html .= "<option value='' disabled='disabled'>&nbsp;&nbsp;&nbsp;".$n2->getName()."</option>";
        
        														//db
        														$res = $DBc->sqlQuery("SELECT aa_id,aal_name FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$_USER->getLang()."' AND aal_achievement=aa_id) WHERE aa_category='".$n2->getID()."' ORDER by aa_sticky DESC, aal_name ASC");
        														$sz = sizeof($res);
        														for($i=0;$i<$sz;$i++) {
        															$html .= "<option value='".$res[$i]['aa_id']."'";
        															if($res[$i]['aa_id'] == $elem->getMetalink()) {
        																$html .= " selected='selected'";
        															}
        															$html .= ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$res[$i]['aal_name']."</option>";
        														}
        													}
        
        													//db
        													$res = $DBc->sqlQuery("SELECT aa_id,aal_name FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$_USER->getLang()."' AND aal_achievement=aa_id) WHERE aa_category='".$n->getID()."' ORDER by aa_sticky DESC, aal_name ASC");
        													$sz = sizeof($res);
        													for($i=0;$i<$sz;$i++) {
        														$html .= "<option value='".$res[$i]['aa_id']."'";
        														if($res[$i]['aa_id'] == $elem->getMetalink()) {
        															$html .= " selected='selected'";
        														}
        														$html .= ">&nbsp;&nbsp;&nbsp;".$res[$i]['aal_name']."</option>";
        													}
        												}*/
        $html .= str_replace("value='" . $elem->getMetalink() . "'", "value='" . $elem->getMetalink() . "' selected='selected'", $metalist);
        $html .= "</select></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td colspan='2'><input type='submit' value='save' /></td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</div>";
        #if(($i%2) == 1) {
        $html .= "</td></tr>";
        #}
        #if(!$skip) {
        #	$i++;
        #}
        #$skip = false;
    }
    #if(($i%2) == 1) {
    #	$html .= "</tr>";
    #}
    $html .= "</table></center>";
    return $html;
}