/** Shows the dialog with the GtkCalendar()-object. */ function showDialog(){ $date_unix = msgbox(gtext("Choose date"), $this->date_unix, "date"); if ($date_unix){ $this->date_unix = $date_unix; $this->entry->set_text(date("d-m-Y", $date_unix)); $this->eventm->callEvent("changed", $this->date_unix); $this->eventm->callEVent("changed-manually", $this->date_unix); } }
/** * Destroys a object. If the object's objects contains destroy-methods, these will be called. * Unsetting alle variables to free memory. * * @param Object $obj The object which should be free'ed. */ function destroy_obj($obj){ if (!is_object($obj)){ throw new Exception(gtext("destroy_obj(): The given argument is not a object.")); } $arr = get_object_vars($obj); if (is_array($arr)){ foreach($arr AS $key => $value){ if (is_object($value)){ //if (method_exists($value, "destroy")){ //$value->destroy(); //} unset($value); unset($obj->$key); }else{ unset($obj->$key); } } } unset($obj); }
function form_drawInput($args){ if (is_array($args["value"]) && is_callable($args["value"])){ $value = call_user_func($args["value"]); }elseif(is_array($args["value"]) and ($args["value"]["type"] == "arr_rows" or $args["value"]["type"] == "arr_values")){ //do nothing. }elseif(is_array($args["value"]) && is_object($args["value"][0])){ $value = $args["value"][0]->$args["value"][1]($args["value"][2]); }else{ if ($args["value"] === null && array_key_exists("default", $args)){ $value = $args["default"]; }else{ $value = $args["value"]; } } if (is_array($value)){ $value = null; } if (is_null($value) and array_key_exists("default", $args)){ $value = $args["default"]; } if ($value and $args["value_callback"]){ if (array_key_exists(1, $args["value_callback"])){ $value = call_user_func($args["value_callback"][0], $value, $args["value_callback"][1]); }else{ $value = call_user_func($args["value_callback"][0], $value); } } if (!$args["type"]){ $f3 = substr($args["name"], 0, 3); if ($f3 == "che"){ $args["type"] = "checkbox"; }elseif($f3 == "tex"){ $args["type"] = "text"; }elseif($f3 == "sel" or array_key_exists("opts", $args)){ $args["type"] = "select"; }elseif($f3 == "fil"){ $args["type"] = "file"; }elseif($f3 == "rad"){ $args["type"] = "radio"; } } if (!$args["id"]){ $id = $args["name"]; }else{ $id = $args["id"]; } if (!$args["type"]){ $args["type"] = "text"; } if ($args["type"] == "password" and !$args["class"]){ $args["class"] = "input_text"; } if (!$args["class"]){ $args["class"] = "input_" . $args["type"]; } if ($args["colspan"]){ $colspan_cont = $args["colspan"] - 1; } $classes_tr = array(); if ($args["classes_tr"]){ $classes_tr = array_merge($classes_tr, $args["classes_tr"]); } if (!array_key_exists("tr", $args) or $args["tr"]){ if (!empty($classes_tr)){ ?><tr class="<?php echo implode(" ", $classes_tr); ?> "><? }else{ ?><tr><? } } if ($args["title"]){ $title_html = htmlspecialchars($args["title"]); }elseif($args["title_html"]){ $title_html = $args["title_html"]; } if ($args["div"]){ $title_html = "<div>" . $title_html . "</div>"; } $css = array(); $td_html = "<td class=\"tdc\""; if ($args["td_width"]){ $css["width"] = $args["td_width"]; } if ($args["align"]){ $css["text-align"] = $args["align"]; } if (!empty($css)){ $td_html .= " style=\""; foreach($css as $key => $val){ $td_html .= $key . ": " . $val . ";"; } $td_html .= "\""; } if ($colspan_cont > 1){ $td_html .= " colspan=\"" . $colspan_cont . "\""; } $td_html .= ">"; if ($args["div"]){ $td_end_html = "</div></td>"; $td_html .= "<div>"; }else{ $td_end_html = "</td>"; } $js_tags = ""; $js_tags_arr = array("onkeyup", "onkeydown", "onchange"); foreach($js_tags_arr AS $js_tag){ if ($args[$js_tag]){ $js_tags .= " " . $js_tag . "=\"" . $args[$js_tag] . "\""; } } if (array_key_exists("autocomplete", $args) and !$args["autocomplete"]){ $js_tags .= " autocomplete=\"off\""; } if ($args["type"] == "numeric"){ $value = number_out($value, $args["decis"]); } if ($args["classes"]){ $classes = $args["classes"]; }else{ $classes = array(); } $classes[] = $args["class"]; $args["class"] = implode(" ", $classes); if ($args["type"] == "spacer"){ ?><td colspan="2"> </td><? }elseif($args["type"] == "checkbox"){ ?> <td colspan="2" class="tdcheck"> <input<?if ($args["disabled"]){?> disabled<?}?> type="<?php echo $args["type"]; ?> " name="<?php echo $args["name"]; ?> " id="<?php echo $id; ?> "<?if ($value){?> checked="checked"<?}?><?php echo $js_tags; ?> /> <label for="<?php echo $id; ?> "><?php echo $title_html; ?> </label> </td> <? }elseif($args["type"] == "select"){ $etags = ""; if ($args["multiple"]){ $etags .= " multiple=\"multiple\""; } if ($args["height"]){ $etags .= " height=\"" . htmlspecialchars($args["height"]) . "\""; } if (is_null($value) and is_array($args["value"])){ $value = $args["value"]; } ?> <td class="tdt"> <?php echo $title_html; ?> </td> <?php echo $td_html; ?> <select<?php echo $etags; ?> <?if ($args["size"]){?> size="<?php echo htmlspecialchars($args["size"]); ?> "<?}?> name="<?php echo htmlspecialchars($args["name"]); ?> " id="<?php echo htmlspecialchars($id); ?> " class="<?php echo $args["class"]; ?> "<?php echo $js_tags; ?> > <?php echo select_drawOpts($args["opts"], $value); ?> </select> <?if ($args["moveable"]){?> <div style="padding-top: 3px;"> <input type="button" value="<?php echo _("Up"); ?> " onclick="select_moveup($('#<?php echo $id; ?> '));" /> <input type="button" value="<?php echo _("Down"); ?> " onclick="select_movedown($('#<?php echo $id; ?> '));" /> </div> <?}?> <?php echo $td_end_html; ?> <? }elseif($args["type"] == "imageupload"){ if ($args["filetype"]){ $ftype = $args["filetype"]; }else{ $ftype = "jpg"; } if (!$value){ $fn = null; }else{ $fn = $args["path"] . "/" . $value . "." . $ftype; } if (!$fn or !file_exists($fn)){ $found = false; $fn_nopic = "images/nopicture.jpg"; $fn = null; if (file_exists($fn_nopic)){ $fn = $fn_nopic; } }else{ $found = true; } if ($args["dellink"]){ $args["dellink"] = str_replace("%value%", $value, $args["dellink"]); } ?> <td class="tdt"> <?php echo $title_html; ?> </td> <?php echo $td_html; ?> <table class="designtable"> <tr> <td style="width: 100%;"> <input type="file" name="<?php echo htmlspecialchars($args["name"]); ?> " id="<?php echo htmlspecialchars($id); ?> " class="<?php echo htmlspecialchars($args["class"]); ?> " /> </td> <td> <?if ($fn){?> <img src="image.php?picture=<?php echo urlencode($fn); ?> &smartsize=80&edgesize=20&equaldim=true" alt="Preview" /> <?}?> <?if ($found and $args["dellink"]){?> <div style="text-align: center;"> <?if (function_exists("gtext")){?> (<a href="javascript: if (confirm('<?php echo gtext("Do you want to delete the picture?"); ?> ')){location.href='<?php echo $args["dellink"]; ?> ';}"><?php echo gtext("delete"); ?> </a>) <?}elseif(function_exists("_")){?> (<a href="javascript: if (confirm('<?php echo _("Do you want to delete the picture?"); ?> ')){location.href='<?php echo $args["dellink"]; ?> ';}"><?php echo _("delete"); ?> </a>) <?}else{?> (<a href="javascript: if (confirm('Do you want to delete the picture?')){location.href='<?php echo $args["dellink"]; ?> ';}"><?php echo _("delete"); ?> </a>) <?}?> </div> <?}?> </td> </tr> </table> <?php echo $td_end_html; ?> <? }elseif($args["type"] == "file"){ ?> <td class="tdt"> <?php echo $title_html; ?> </td> <?php echo $td_html; ?> <input type="file" class="input_<?php echo $args["type"]; ?> " name="<?php echo htmlspecialchars($args["name"]); ?> " id="<?php echo htmlspecialchars($id); ?> "<?php echo $js_tags; ?> /> <?php echo $td_end_html; ?> <? }elseif($args["type"] == "textarea"){ ?> <td class="tdt"> <?php echo $title_html; ?> </td> <?php echo $td_html; ?> <textarea name="<?php echo htmlspecialchars($args["name"]); ?> " id="<?php echo htmlspecialchars($id); ?> " class="<?php echo htmlspecialchars($args["class"]); ?> "<?if ($args["height"]){?> style="height: <?php echo $args["height"]; ?> ;"<?}?><?php echo $js_tags; ?> ><?php echo htmlspecialchars_textarea($value); ?> </textarea> <?php echo $td_end_html; ?> <? }elseif($args["type"] == "fckeditor"){ ?> <td class="tdt"> <?php echo $title_html; ?> </td> <?php echo $td_html; ?> <? $fck = new fckeditor($args["name"]); if ($args["height"]){ $fck->Height = $args["height"]; }else{ $fck->Height = 300; } $fck->Value = $value; $fck->Create(); ?> <?php echo $td_end_html; ?> <? }elseif($args["type"] == "radio"){ $id = $id . "_" . $value; ?> <td class="tdt" colspan="2"> <input type="radio" id="<?php echo htmlspecialchars($id); ?> " name="<?php echo htmlspecialchars($args["name"]); ?> " value="<?php echo htmlspecialchars($args["value"]); ?> "<?if ($args["checked"]){?> checked="checked"<?}?><?php echo $js_tags; ?> /> <label for="<?php echo htmlspecialchars($id); ?> "> <?php echo $title_html; ?> </label> </td> <? }elseif($args["type"] == "info"){ ?> <td class="tdt"> <?php echo $title_html; ?> </td> <?php echo $td_html; ?> <?php echo $value; ?> <?php echo $td_end_html; ?> <? }elseif($args["type"] == "plain"){ ?> <td class="tdt"> <?php echo $title_html; ?> </td> <?php echo $td_html; ?> <?php echo htmlspecialchars($value); ?> <?php echo $td_end_html; ?> <? }elseif($args["type"] == "headline"){ ?> <td class="tdheadline" colspan="2"> <?php echo $title_html; ?> </td> <? }else{ ?> <td class="tdt"> <?php echo $title_html; ?> </td> <?php echo $td_html; ?> <input type="<?php echo htmlspecialchars($args["type"]); ?> "<?if ($args["disabled"]){?> disabled<?}?><?if ($args["maxlength"]){?> maxlength="<?php echo $args["maxlength"]; ?> "<?}?> class="<?php echo $args["class"]; ?> " id="<?php echo htmlspecialchars($id); ?> " name="<?php echo htmlspecialchars($args["name"]); ?> " value="<?php echo htmlspecialchars($value); ?> "<?php echo $js_tags; ?> /> <?php echo $td_end_html; ?> <? } if (!array_key_exists("tr", $args) or $args["tr"]){ ?></tr><? } if ($args["descr"]){ $descr = $args["descr"]; if ($args["div"]){ $descr = "<div class=\"tdd\">" . $descr . "</div>"; } ?> <tr> <td colspan="2"<?if (!$args["div"]){?> class="tdd"<?}?>> <?php echo $descr; ?> </td> </tr> <? } }
function gtext($string){ if (function_exists("gtext")){ return gtext($string); }elseif(function_exists("_")){ return _($string); }elseif(function_exists("gettext")){ return gettext($string); }else{ return $string; } }