kristhasirah |
05-05-2015 12:26 PM |
after trying and testing I manage to make the code work, because copy and paste just gives a blank page, and so i will post the code thats working for me for those that don't have idea what to do... like me XD
in admincp/image.php find:
PHP Code:
public function manage(){ $mysidia = Registry::get("mysidia"); $stmt = $mysidia->db->select("filesmap", array("id", "wwwpath")); $filesMap = new LinkedHashMap; while($file = $stmt->fetchObject()){ $filesMap->put(new Integer($file->id), new Image($file->wwwpath)); } $this->setField("filesMap", $filesMap); }
and replace with:
PHP Code:
public function manage(){ $mysidia = Registry::get("mysidia"); $stmt = $mysidia->db->select("filesmap", array("id", "wwwpath")); $total = $mysidia->db->select("filesmap", array("id"))->rowCount(); $pagination = new Pagination($total, 20, "admincp/image/delete"); $pagination->setPage($mysidia->input->get("page")); $stmt = $mysidia->db->select("filesmap", array("id", "wwwpath"), "1 LIMIT {$pagination->getLimit()},{$pagination->getRowsperPage()}"); $filesMap = new LinkedHashMap; while($file = $stmt->fetchObject()){ $filesMap->put(new Integer($file->id), new Image($file->wwwpath));
} $this->setField("pagination", $pagination); $this->setField("filesMap", $filesMap); }
in admincp/view/imageview.php find:
PHP Code:
public function manage(){ $mysidia = Registry::get("mysidia"); $document = $this->document; $document->setTitle($this->lang->manage_title); $document->addLangvar($this->lang->manage); $imageForm = new Form("manageform", "delete", "post"); $filesMap = $this->getField("filesMap"); $iterator = $filesMap->iterator(); while ($iterator->hasNext()){ $file = $iterator->next(); $fileID = $file->getKey(); $fileImage = $file->getValue(); $fileImage->setLineBreak(TRUE); $action = new RadioButton("Delete this Image", "iid", $fileID->getValue()); $action->setLineBreak(TRUE); $imageForm->add($fileImage); $imageForm->add($action); } $imageForm->add(new Button("Submit", "submit", "submit")); $document->add($imageForm); }
and replace with this:
PHP Code:
public function manage(){ $mysidia = Registry::get("mysidia"); $document = $this->document; $document->setTitle($this->lang->manage_title); $document->addLangvar($this->lang->manage); $pagination = $this->getField("pagination");
$imageForm = new Form("manageform", "delete", "post"); $imageForm->add(new Comment($pagination->showPage())); $filesMap = $this->getField("filesMap"); $iterator = $filesMap->iterator(); while ($iterator->hasNext()){ $file = $iterator->next(); $fileID = $file->getKey(); $fileImage = $file->getValue(); $fileImage->setLineBreak(TRUE); $action = new RadioButton("Delete this Image", "iid", $fileID->getValue()); $action->setLineBreak(TRUE); $imageForm->add(new Comment("<div style='display:inline-block;width:100px;margin-top:20px;'>",FALSE)); $imageForm->add($fileImage); $imageForm->add($action); $imageForm->add(new Comment("</div>", FALSE)); } $imageForm->add(new Comment($pagination->showPage())); $imageForm->add(new Button("Submit", "submit", "submit")); $document->add($imageForm); }
those are the codes that are working for me, hope it works for everyone else =)
and thanks anno1986 for posting the code ^^ because if i tried to do it myself i probably wont be able to do it.
also replace the "20" with the number of images you want to see in each page and replace "100" with the max width of your adoptbles.
|