45 abstract protected function headerLabelPrefixContent();
77 $this->controllerId = $controllerId;
78 $this->moduleId = $moduleId;
79 $this->model = $model;
81 $this->start = $start;
84 $this->refreshActionId = $refreshActionId;
85 $this->progressBarId =
'progressBar';
86 $this->title = $title;
97 return CJSON::encode($this->renderRefreshScript());
100 public function renderRefreshScript()
102 $value = $this->getProgressValue();
105 $callback = $this->getCreateProgressBarAjax($this->progressBarId);
106 $message = $this->getMessage();
112 $message = $this->getCompleteMessage();
117 'callback' => $callback,
119 'message' => $message,
124 protected function renderContent()
126 $cClipWidget =
new CClipWidget();
127 $cClipWidget->beginClip(
"ProgressBar");
128 $cClipWidget->widget(
'zii.widgets.jui.CJuiProgressBar', array(
129 'id' => $this->progressBarId,
130 'value' => $this->getProgressValue(),
132 'create' =>
'js:function(event, ui)
134 ' . $this->getCreateProgressBarAjax($this->progressBarId) .
';
135 $("#progress-percent").html( Math.ceil($(\'#' . $this->progressBarId .
'\').progressbar(
"value")) +
"%");
137 'change
' => 'js:
function(event, ui)
139 $(
"#progress-percent").html( Math.ceil($(\
'#' . $this->progressBarId .
'\').progressbar(
"value")) +
"%");
141 'complete
' => 'js:
function(event, ui)
143 $(
".progressbar-wrapper").fadeOut(250);
144 $(\
'#' . $this->progressBarId .
'-links\').show();
148 $cClipWidget->endClip();
149 $progressBarContent = $cClipWidget->getController()->clips[
'ProgressBar'];
150 $content =
"<div><h1>" . $this->headerLabelPrefixContent() .
' : ' . $this->title .
'</h1>';
151 $content .=
'<div class="progress-counter">';
152 $content .=
'<h3><span id="' . $this->progressBarId .
'-msg">' . $this->getMessage() .
'</span></h3>';
153 $content .=
'<div class="progressbar-wrapper"><span id="progress-percent">0%</span>' . $progressBarContent .
'</div>';
154 $content .= $this->renderFormLinks();
155 $content .=
'</div>';
156 $content .=
'</div>';
162 return ZurmoHtml::ajax(array(
164 'dataType' =>
'json',
165 'data' => Yii::app()->getUrlManager()->createPathInfo($_POST,
'=',
'&'),
166 'url' => Yii::app()->createUrl($this->moduleId .
'/' . $this->controllerId .
'/' . $this->refreshActionId,
167 array_merge($_GET, array( get_class($this->model) .
'_page' => ($this->page + 1),
'totalCount' => $this->totalRecordCount))
169 'success' =>
'function(data)
178 protected function getProgressValue()
180 $value = ($this->getEndSize() / $this->totalRecordCount) * 100;
191 protected function getEndSize()
193 $end = $this->start + $this->pageSize - 1;
194 if ($end > $this->totalRecordCount)
196 return $this->totalRecordCount;
205 protected function onProgressComplete()
__construct($controllerId, $moduleId, $model, $totalRecordCount, $start, $pageSize, $page, $refreshActionId, $title)
renderRefreshJSONScript()