I have a table *sitepage_manageadmins* which contain: " user_id, page_id ". There is another table *sitepage_pages* which contain " page_id, title ".
Im trying to render as dropdown ( select list ) in Zend_Form the user which is admin to relevant page_id .
Here is my code:
$this->view->owner_id = $viewer_id = $viewer->getIdentity(); // get $viewer
$adminpages = Engine_Api::_()->getDbtable('manageadmins', 'sitepage')->getManageAdminPages($viewer_id); // get viewer page_id's where is admin
Getting the page_id as dropdown list:
$ids = array ( 0 => '-- Select --');
foreach ($adminpages as $adminpage) {
$ids[] = $adminpage->page_id;
}
Rendering the dropdown
$this->addElement('select', 'page_id', array (
'label' => 'Page where I'm Admin',
'multioptions' => $ids,
));
For now, im only render the Page_ID numbers as dropdown. I want from Specific Page_ID to render the Title.
Any ideas are welcome? Thanks