3 require_once 'CRM/Core/Page.php';
4 require_once 'CRM/Wci/DAO/ProgressBar.php';
6 class CRM_Wci_Page_ProgressBarList
extends CRM_Core_Page
{
7 private static $_actionLinks;
9 // get the requested action
10 $action = CRM_Utils_Request
::retrieve('action', 'String',
11 // default to 'browse'
12 $this, FALSE, 'browse'
15 // assign vars to templates
16 $this->assign('action', $action);
17 $id = CRM_Utils_Request
::retrieve('id', 'Positive',
22 if ($action & CRM_Core_Action
::UPDATE
) {
23 echo "UPDATE clicked";
24 $controller = new CRM_Core_Controller_Simple('CRM_Wci_Form_ProgressBar',
26 CRM_Core_Action
::UPDATE
28 $controller->set('id', $id);
29 $controller->process();
30 return $controller->run();
32 } elseif ($action & CRM_Core_Action
::DELETE
) {
33 echo "delete clicked";
37 // Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml
38 CRM_Utils_System
::setTitle(ts('ProgressBarList'));
40 // Example: Assign a variable for use in a template
41 $this->assign('currentTime', date('Y-m-d H:i:s'));
43 $query = "SELECT * FROM civicrm_wci_progress_bar";
46 $dao = CRM_Core_DAO
::executeQuery($query, $params, TRUE, 'CRM_WCI_DAO_ProgressBar');
48 while ($dao->fetch()) {
49 $con_page[$dao->id
] = array();
50 CRM_Core_DAO
::storeValues($dao, $con_page[$dao->id
]);
51 //print_r($con_page[$dao->id]['starting_amount']);
53 $action = array_sum(array_keys($this->actionLinks()));
54 //build the normal action links.
55 $con_page[$dao->id
]['action'] = CRM_Core_Action
::formLink(self
::actionLinks(),
57 array('id' => $dao->id
),
63 if (isset($con_page)) {
64 $this->assign('rows', $con_page);
68 $query = "SELECT * FROM civicrm_wci_progress_bar";
69 $dao = CRM_Core_DAO::singleValueQuery($query);
75 function &actionLinks() {
76 // check if variable _actionsLinks is populated
77 if (!isset(self
::$_actionLinks)) {
78 // helper variable for nicer formatting
79 $deleteExtra = ts('Are you sure you want to delete this Contribution page?');
80 $copyExtra = ts('Are you sure you want to make a copy of this Contribution page?');
82 self
::$_actionLinks = array(
83 CRM_Core_Action
::UPDATE
=> array(
84 'name' => ts('Update'),
85 'url' => CRM_Utils_System
::currentPath(),
86 'qs' => 'action=update&reset=1&id=%%id%%',
87 'title' => ts('Update'),
89 CRM_Core_Action
::DELETE
=> array(
90 'name' => ts('Delete'),
91 'url' => CRM_Utils_System
::currentPath(),
92 'qs' => 'action=delete&reset=1&id=%%id%%',
93 'title' => ts('Delete Custom Field'),
94 'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"',
98 return self
::$_actionLinks;