public function projectCountsAction()
 {
     $filter = Zend_Json::decode($this->_getParam('data'));
     $rows = Application_Model_Projects::GetProjectCountsByStage($filter);
     $isClient = !ProNav_Auth::isEmployee();
     $jOut = array();
     $s = '';
     $count = 0;
     $project_id = 0;
     if ($rows) {
         foreach ($rows as $row) {
             if ($isClient && ($row->stage_id == ProNav_Utils::STAGE_POTENTIAL || $row->stage_id == ProNav_Utils::STAGE_CANCELLED)) {
                 //skip
             } else {
                 $count += $row->cnt;
                 $title = str_replace('Potential Project', 'Potential Projects', $row->title);
                 $s .= '<div class="project-list">';
                 $title .= ' (' . $row->cnt . ')';
                 $s .= $row->cnt > 0 ? '<a class="stage-has-projects-' . $row->stage_id . '" style="font-weight:bold;outline:none" href="javascript:void(0)" onclick="project.list.toggleProjectStage(' . $row->stage_id . ')">' . $title . '</a>' : '<span style="color:#999;">' . $title . '</span>';
                 $s .= '</div>';
                 $s .= '<div class="project-list-stage" id="stage-' . $row->stage_id . '" style="display:none;"></div>';
                 if ($row->min_id) {
                     $project_id = $row->min_id;
                 }
             }
         }
         if ($count == 1 && $filter['keyword'] != "") {
             $jOut['status'] = 1;
             $jOut['html'] = $project_id;
         } else {
             $jOut['status'] = 0;
             $jOut['html'] = $s;
         }
     } else {
         $jOut['status'] = 0;
         $jOut['html'] = '<div style="margin:10px;font-weight:bold;">No project found using the criteria specified above.</div>';
     }
     echo Zend_Json::encode($jOut);
 }